Article View: comp.os.msdos.programmer
Article #3678Applications and Running out of Memory
From: Elliot H. Mednick
Date: Wed, 07 Oct 1992 15:48
Date: Wed, 07 Oct 1992 15:48
24 lines
1759 bytes
1759 bytes
In article <1992Oct7.001411.8605@novell.com> larrow@novell.com writes: > [...] > My question is why don't applications handle running out of memory in a > nicer fashion? This may seem like a generalization, but it seems to happen > a lot. I would think that since the programmer allocates the memory via > a malloc or whatever, he/she would know when the memory allocation failed > and be able to recover gracefully. Is this a misconception? Am I thinking > on too small a scale? If the application is using some form of malloc() to allocate memory, then they are probably not checking the returned value for zero, which (for better or for worse) indicates that the amount of memory requested is not availble. If it is not checked, then the assigned pointer will be NULL. Since DOS can't detect NULL pointers, then chances are it will be assigned to, most likely modifying DOS's interrupt table. Crash. Most better-written applications have a shell around malloc() that tests for a NULL return value and, if so, prints some informative message and quits gracefully. -- Elliot H. Mednick P.O. Box 150 Wellspring Solutions Sutton, MA. 01590 elliot@Wellspring.com +1 508 865 7271
Technical Details
Message-ID:
<718472882snx@Wellspring.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!unixland!wellspring!elliotReferences:
<1992Oct7.001411.8605@novell.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!unixland!wellspring!elliot From: elliot@Wellspring.COM (Elliot H. Mednick) Newsgroups: comp.os.msdos.programmer Subject: Applications and Running out of Memory Distribution: world Message-ID: <718472882snx@Wellspring.COM> References: <1992Oct7.001411.8605@novell.com> Date: Wed, 07 Oct 92 15:48:02 GMT Organization: Wellspring Solutions, Sutton, MA. Reply-To: elliot@Wellspring.COM Lines: 24