home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / next / programm / 8308 < prev    next >
Encoding:
Text File  |  1993-01-26  |  1.7 KB  |  42 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!van-bc!cs.ubc.ca!fornax!patrice
  3. From: patrice@cs.sfu.ca (Patrice Belleville)
  4. Subject: Re: Memory Allocation Error
  5. Message-ID: <1993Jan23.180844.23627@cs.sfu.ca>
  6. Organization: CSS, Simon Fraser University, Burnaby, B.C., Canada
  7. References: <ofM_2yS00WA78Jzi5C@andrew.cmu.edu>
  8. Distribution: cct
  9. Date: Sat, 23 Jan 1993 18:08:44 GMT
  10. Lines: 30
  11.  
  12. From article <ofM_2yS00WA78Jzi5C@andrew.cmu.edu>, by David Apfelbaum <da0g+@andrew.cmu.edu>:
  13. > Excerpts from netnews.comp.sys.next.programmer: 21-Jan-93 Re: Memory
  14. > Allocation Error by Erich S. Boleyn@alamo.mt 
  15. >>   I have seen this problem many times.  It has always (so far at least)
  16. >>been caused by attempting to call 'free' on a statically allocated string.
  17. >>.....
  18. >>   Basically, your answer is to just bite the bullet and fix the bad
  19. >>code that technically shouldn't have worked anyway, even though SunOS
  20. >>and a few others are permissive.
  21. > ????
  22. > If this truly is the problem, there's a much easier, though far less
  23. > "correct" solution:
  24. > (from "man cc")
  25. >      -fwritable-strings
  26.  
  27.     I'm not sure I see how this  would  help.   The problem is  that,  by
  28. calling 'free'  on something which  has  not been  previously  malloc'ed, you
  29. confuse memory  allocation.  Whether the string is  writable or not, the same
  30. confusion will occur (in fact it might show  up  earlier in  the latter case,
  31. and hence be easier to fix).
  32.                                       Patrice
  33. -- 
  34. /***************************************************************************\
  35. |* Patrice Belleville                      patrice@cs.sfu.ca *|
  36. |*   --- Simon Fraser University is not responsible for my mistakes. ---   *|
  37. \***************************************************************************/
  38.