malloc (was: making a request to IBM)

Pierre Asselin pa at curly.appmag.com
Wed Apr 24 09:54:52 AEST 1991


My newsfeed only worked one way, so I had to be quiet for a while.
Now I'm worldwide again.

Dick Dunn (rcd at ico.isc.com) summarized my own position very well.

> The way I read this, the complaint is from the normal-programmer point of
> view:  There's a defined way to indicate that there's no more memory
> available--return NULL from malloc().  SIGDANGER is an IBM invention.
[... and more statements that I fully endorse]

>> So, do we go back to blowing up processes that allocate too much memory,
>> even though that memory may actually be there by the time the process
>> actually uses it?...
>
> In the case of C programs and malloc(), yes.  If you can't allocate usable
> memory (meaning "usable" at the point of return from malloc()), you should
> return NULL.  That doesn't "blow up" the process; it gives it a fair chance
> to decide what to do.

I have nothing against the SIGDANGER mechanism per se.  It sure beats
what SysV and Mach have to offer.  I have nothing against a sparse
allocator that doesn't lock paging space right away.  But it shouldn't
be called malloc.

QUESTIONS:

Let's say I #ifdef _AIX and I use psmalloc.
 1) Can I touch everything it gives me?
 2) Can I still use it twenty minutes later?
 3) Can I still get burned by routines in libc.a that
    call the regular malloc?
 4) Am I still subject to sudden death if some unrelated
    process bloats up ?

dennis at gpu.utcs.utoronto.ca (Dennis Ferguson) writes:

> Better to explain more exactly why AIX does what it does.  It's so vendors
> who want to sell crufty old Fortran programs which have no way to do
> dynamic memory allocation, can ship binaries with huge static arrays
> compiled in for people who want to solve big problems and still have
> the same binaries run on small machines to solve small problems.  To
> implement this you don't allocate backing store until a page is touched,
> which means malloc() can't return NULL since it can't, in general, know
> if the Fortran program running at the same time is actually going to
> use his pages or not.

 5) OK IBM'ers.  Is this true?  If so, does the Fortran run-time
    support catch SIGDANGER?


I write::

> 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?)

marc at ibmpa.awdpa.ibm.com (Marc Pawliger):

> And us Palo Alto folks?  And Rochester and Kingston folks?  And Research?

I didn't know you existed because I rely too much on official
channels.  Weeeell, OK, you can stay too.

  --Pierre Asselin, R&D, Applied Magnetics.  I speak for me.



More information about the Comp.unix.aix mailing list