Operating System - HP-UX
1748074 Members
5295 Online
108758 Solutions
New Discussion юеВ

Re: LD fails with malloc error on HPUX 11.0

 
A. Clay Stephenson
Acclaimed Contributor

Re: LD fails with malloc error on HPUX 11.0

Hi Carl:

Maxdsiz and maxdsiz_64 are the only limits on how much space you should be able to allocate (assuming you have sufficient swap).

The first thing to be aware of is that top
only show the memory in use by processes. Kernel memory is not included (e.g. buffer cache). You really can't use top as a means of showing available memory. I assume you have looked at maxdsiz with sysdef. I would now add more swap as filesystem swap with low priority.
This can be done 'on the fly' and does not require a reboot. Run you malloc program and see what happens. I spent about 5 minutes creating and testing one of my own under 64-bit 11.0 (maxdsiz 640MB maxdsiz_64 1GB). Both the 32-bit and 64-bit versions died exactly as expected. I tried both the ANSI/C and aCC compilers and both behaved the same. I am at the latest General Release Patch level. If you are not at that level, I would apply the General Release patchset first.

My one thought is that you have that dreaded dynamic buffer cache enabled and max_dbc_pct set to the default 50%; if so, lower it to about 10% with min at 5% and see what happens,

Regards, Clay
If it ain't broke, I can fix that.
Carl Erhorn
Advisor

Re: LD fails with malloc error on HPUX 11.0

I have dbc_min_pct and dbc_max_pct set to 2%. And yes, swapmem_on is set to 1.

These settings were done by my admin, as I am
just a lowly developer. So I really don't have a good understanding of the implications down to a very detailed level. However, I did understand that 50% min and max are are very bad choice, from what I've learned here.

By the way, this system is running 32-bit mode only, so the _64-bit issues don't apply.

You mention that your test program failed just where expected. Do you mean that like mine, you hit a spot where you cannot malloc any additional memory?

--Carl
A. Clay Stephenson
Acclaimed Contributor

Re: LD fails with malloc error on HPUX 11.0

Hi Carl:

What I meant was that both the 32-bit and 64-bit versions died with ENOMEM at 640 MB and 1024 MB exactly where I have maxdsiz and maxdsiz_64 set on this box. My little memtest program does nothing but malloc until malloc returned NULL. What I am trying to say is that the memory allocation worked and behaved as expected. One important point is that I did no free()'s ; no reallocs(), just malloc(1MB) after malloc(1MB) until it returned NULL. I don't have enough memory in my only 32-bit 11.0 to really test this but the 64-bit versions seems just fine.

Clay

Clay
If it ain't broke, I can fix that.