Showing results for 
Search instead for 
Did you mean: 

malloc internals

Occasional Visitor

malloc internals

I was wondering if there is any public information about the internals of the malloc() function (and the rest of it's family) that is used on hp-ux (> 8.x).

James Murtagh
Honored Contributor

Re: malloc internals


To ask for the internals of a routine like this is like asking for the source, which HP don't disclose and no (sensible) HP employee would give. Look at the linux source for a general idea:

If you have any further questions, please let me know and I'll do my best to answer them.


Bill Hassell
Honored Contributor

Re: malloc internals

The malloc internals probably won't solve any programming problems. If you are trying to malloc large amounts of memory and are getting errno 12 (ENOMEM), most likely you are compiling a 32bit program and are not aware of the addressing limitations of these programs. If this is the case, start with the kernel parameter: maxdsiz which prevents any 32bit program from getting more than 64megs (the default value) of RAM.

You can set maxdsiz to about 2Gb but then you'll run into another limit at about 950 megs. Your program must be recompiled or relinked with -Wl -N options so both quadrant 2 and most of quadrant 1 can be used for malloc calls. In that case, you'll gain access to almost 1750 megs in a malloc call.

Beyond Q1+Q2 usage, you can use the +q3p and +q4p options but this depends on the opsystem version (11.0 with patches or 11i). Read the mem_mgt *and* proc_mgmt white papers in /usr/share/doc. They are missing in 11i so download them from

Bill Hassell, sysadmin