home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.next.programmer
- Path: sparky!uunet!van-bc!cs.ubc.ca!fornax!patrice
- From: patrice@cs.sfu.ca (Patrice Belleville)
- Subject: Re: Memory Allocation Error
- Message-ID: <1993Jan23.180844.23627@cs.sfu.ca>
- Organization: CSS, Simon Fraser University, Burnaby, B.C., Canada
- References: <ofM_2yS00WA78Jzi5C@andrew.cmu.edu>
- Distribution: cct
- Date: Sat, 23 Jan 1993 18:08:44 GMT
- Lines: 30
-
- 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. --- *|
- \***************************************************************************/
-