Article View: gnu.gcc.help
Article #53549Re: xmalloc in ld.c
From: David J. MacKenzie
Date: Fri, 25 Oct 1991 03:03
Date: Fri, 25 Oct 1991 03:03
9 lines
1256 bytes
1256 bytes
Most versions of malloc return a pointer to a zero-length part of the heap when you ask them for 0 bytes. Some versions of malloc return a NULL pointer then instead, which is indistinguishable from an out of memory error. Either add a line to xmalloc which checks for a request for 0 bytes and changes it to a request for 1 byte, or use a debugger to find out where the request for 0 bytes is coming from -- it's probably an error, since there is no point in allocating 0 bytes. -- David J. MacKenzie <djm@eng.umd.edu> <djm@ai.mit.edu>
Technical Details
Message-ID:
<DJM.91Oct24220332@frob.eng.umd.edu>Path:
arc1-ca.pugleaf.net!gmdzi!zeus.ieee.org!sdd.hp.com!spool.mu.edu!olivea!uunet!europa.asd.contel.com!darwin.sura.net!mojo.eng.umd.edu!news!djmReferences:
<9110232051.AA13426@acds.physik.rwth-aachen.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,ddea593a656d66c5 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1991-10-25 07:40:20 PST Path: arc1-ca.pugleaf.net!gmdzi!zeus.ieee.org!sdd.hp.com!spool.mu.edu!olivea!uunet!europa.asd.contel.com!darwin.sura.net!mojo.eng.umd.edu!news!djm From: djm@eng.umd.edu (David J. MacKenzie) Newsgroups: gnu.gcc.help Subject: Re: xmalloc in ld.c Message-ID: <DJM.91Oct24220332@frob.eng.umd.edu> Date: 25 Oct 91 03:03:32 GMT References: <9110232051.AA13426@acds.physik.rwth-aachen.de> Distribution: gnu Organization: Project GLUE, University of Maryland Lines: 9 In-Reply-To: kuku@acds.physik.rwth-aachen.de's message of Wed, 23 Oct 1991 20:51:06 GMT