Article View: gnu.gcc.help
Article #41592Re: Segmentation fault from a call to malloc()
From: Bart Van Hoyweghen
Date: Thu, 14 Mar 1996 00:00
Date: Thu, 14 Mar 1996 00:00
8 lines
943 bytes
943 bytes
In general, malloc() fails when you used free() on the wrong address (e.g. an address not returned by a previous malloc) or when a buffer returned by another call to malloc() overflowed. I do not know enough about gcc to go into detail but normally malloc() and free() use linked lists to maintain a free and a used list. This information is kept in the same memory regions. Use a tool like boundschecker, or purify (I am not aware of freeware tools) or overload malloc() and free() to do some bookkeeping.
Technical Details
Message-ID:
<4i90vn$jru@news.be.innet.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4i7jd0$40g@flotsam.ee.pdx.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,e9f0bbedcf508bc8 X-Google-Attributes: gid11318c,public From: bvh@acse.be (Bart Van Hoyweghen) Subject: Re: Segmentation fault from a call to malloc() Date: 1996/03/14 Message-ID: <4i90vn$jru@news.be.innet.net> X-Deja-AN: 142624828 references: <4i7jd0$40g@flotsam.ee.pdx.edu> organization: A.C.S.E. reply-to: bvh@acse.be newsgroups: gnu.gcc.help