Re: malloc internals (212 Views)
Reply
Occasional Visitor
ilja_1
Posts: 1
Registered: ‎08-12-2003
Message 1 of 3 (212 Views)

malloc internals

Hi,
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).

Honored Contributor
James Murtagh
Posts: 551
Registered: ‎02-18-2002
Message 2 of 3 (212 Views)

Re: malloc internals

Hi,

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:

http://www.linux.org/

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

Cheers,

James.
Honored Contributor
Bill Hassell
Posts: 14,218
Registered: ‎05-29-2000
Message 3 of 3 (212 Views)

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 http://docs.hp.com
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.