malloc (was: making a request to IBM)

Marc Pawliger marc at ibmpa.awdpa.ibm.com
Mon Apr 15 07:29:02 AEST 1991


In article <1991Apr9.024814.1141 at appmag.com>, pa at 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 at ibminet.awdpa.ibm.com        VNET:    MARCP at AUSVM6  |
|    UUCP:     uunet!ibminet.awdpa.ibm.com!marc  Phone:   (415) 855-3493  |
+-----IBMinet:  marc at ibmpa.awdpa.ibm.com----------IBM T/L:  465-3493------+

These are my opinions, not IBM's etc etc etc



More information about the Comp.unix.aix mailing list