Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!romp!auschs!panews!ibmpa.awdpa.ibm.com!marc From: marc@ibmpa.awdpa.ibm.com (Marc Pawliger) Newsgroups: comp.unix.aix Subject: Re: malloc (was: making a request to IBM) Keywords: malloc psalloc paging space Message-ID: <1991Apr14.142902@ibmpa.awdpa.ibm.com> Date: 14 Apr 91 21:29:02 GMT References: <1991Apr9.024814.1141@appmag.com> Sender: news@ibmpa.awdpa.ibm.com (news id) Reply-To: marc@ibmpa.awdpa.ibm.com (Marc Pawliger) Organization: IBM Advanced Workstations Division, Palo Alto Lines: 38 In article <1991Apr9.024814.1141@appmag.com>, pa@appmag.com (Pierre Asselin) writes: |> The problem: as you all remember, malloc() returns NULL only |> when the process exceeds its datasize limit. If malloc returns a |> non-null pointer, the memory may turn out to be exceedingly |> virtual: there won't be any paging space behind it. AIX runs |> out of paging space when the process actually uses the memory. |> Various processes die. In Info, see `List of Books', `General |> Concepts and Procedures', scroll ~1/3 down, `Paging Space |> Overview'. See also psmalloc.c in /usr/lpp/bos/samples. Etc etc |> etc. |> |> Personally, I think it's a bug. If there is no memory left, |> malloc should return a NULL. IBM says it's a feature, catch |> SIGDANGER if you don't like it. [ ... ] Note that Mach also allows you to get in over your head. You can malloc all you want, but until you actually touch those alloc'd pages, they _will_ _not_ _exist_. So I can malloc 2GB on my 4M machine with 10M swap space and not see one NULL pointer return. If I try and _use_ all that memory, though, my program will die, after thouroughly thrashing my machine. I have heard tales that this was due to a Lisp project at CMU that used the high bits of an address to store that data type, so they had addresses that were clustered in a huge virtual memory space, but they were sparse enough so that the actual sum of all the space _used_ fit into physical memory and swap space. |> Austin: STAY ON THE NET! You're the only way we'll ever get the |> straight dope. (Anyone care to give us the straight dope on this one?) And us Palo Alto folks? And Rochester and Kingston folks? And Research? +--Marc Pawliger----IBM Advanced Workstations Division----Palo Alto, CA---+ | Internet: marc@ibminet.awdpa.ibm.com VNET: MARCP at AUSVM6 | | UUCP: uunet!ibminet.awdpa.ibm.com!marc Phone: (415) 855-3493 | +-----IBMinet: marc@ibmpa.awdpa.ibm.com----------IBM T/L: 465-3493------+ These are my opinions, not IBM's etc etc etc