🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
2 messages
2 total messages Started by David Apfelbaum Sat, 23 Jan 1993 01:34
Re: Memory Allocation Error
#2274
Author: David Apfelbaum
Date: Sat, 23 Jan 1993 01:34
27 lines
1518 bytes
Excerpts from netnews.comp.sys.next.programmer: 21-Jan-93 Re: Memory
Allocation Error by Erich S. Boleyn@alamo.mt 
>   I have seen this problem many times.  It has always (so far at least)
>been caused by attempting to call 'free' on a statically allocated string.
>.....
>   Basically, your answer is to just bite the bullet and fix the bad
>code that technically shouldn't have worked anyway, even though SunOS
>and a few others are permissive.


????

If this truly is the problem, there's a much easier, though far less
"correct" solution:

(from "man cc")
     -fwritable-strings
          Store string constants in the writable data segment and
          don't make them unique.  This is for compatibility with
          old programs that assume they can write into string
          constants.  Writing into string constants is a very bad
          idea; "constants" should be constant.


Remember, NeXT 'cc' is/was based around GNU's gcc.

        -David.
Re: Memory Allocation Error
#2342
Author: Patrice Belleville
Date: Sat, 23 Jan 1993 18:08
30 lines
1787 bytes
From article <ofM_2yS00WA78Jzi5C@andrew.cmu.edu>, by David Apfelbaum <da0g+@andrew.cmu.edu>:
> Excerpts from netnews.comp.sys.next.programmer: 21-Jan-93 Re: Memory
> Allocation Error by Erich S. Boleyn@alamo.mt 
>>   I have seen this problem many times.  It has always (so far at least)
>>been caused by attempting to call 'free' on a statically allocated string.
>>.....
>>   Basically, your answer is to just bite the bullet and fix the bad
>>code that technically shouldn't have worked anyway, even though SunOS
>>and a few others are permissive.
> 
> 
> ????
> 
> If this truly is the problem, there's a much easier, though far less
> "correct" solution:
> 
> (from "man cc")
>      -fwritable-strings

	I'm not sure I see how this  would  help.   The problem is  that,  by
calling 'free'  on something which  has  not been  previously  malloc'ed, you
confuse memory  allocation.  Whether the string is  writable or not, the same
confusion will occur (in fact it might show  up  earlier in  the latter case,
and hence be easier to fix).
								      Patrice
-- 
/***************************************************************************\
|* Patrice Belleville 					 patrice@cs.sfu.ca *|
|*   --- Simon Fraser University is not responsible for my mistakes. ---   *|
\***************************************************************************/
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads