Operating System - HP-UX
1847214 Members
3244 Online
110263 Solutions
New Discussion

Re: 800MB malloc limit???

 
SOLVED
Go to solution
Pavel Hampl
Occasional Advisor

800MB malloc limit???

Hi admins,

I am little bit confused, because I have already thought that on HPUX 11.00 is max size of allocated memory by a process restricted only by maxdsiz (maxdsiz_64bit). But it DOES NOT work!!! Even if it is 4GB I cannot allocate more that 800MG-1GB.

One my application reached this limit. So I prepared a simple C program for prove it. I tested it on my 3 L1000 (HPUX 11.00) servers. Every server has different maxdsiz_64, but all have more than 1G and malloc always failed between 800MB and 1GB. On all server is 3,5-4GB RAM and up to 10GB swap. No swapping problem (used < 30%) memory usage 70-80%. But it does not work even if there is 3GB RAM free and swap < 10% from 10GB.
What is wrong? Is there another parameter?

Her is testing C program :
----------------------------------
#include
/*
maxdsiz 3221225472 (0XC0000000)
maxdsiz_64bin 4026531840 (0X00000000F0000000)
maxssiz 268435456 (0X10000000)
maxssiz_64bit 1073741824 (0X40000000)
maxtsiz 1073741824 (0X40000000)
maxtsiz_64bit 1073741824 (0X40000000)
shmmax 4GB
*/

main ()
{
char *t;
int n=1000000;
int i, sum;
int j=790000000;

for (i=1; i< 600; i++) {
sum = i * n + j;
printf("test %i\n", sum);
t = (char *)malloc(sum);
if ((char *)t == (char *)NULL) {
perror ("malloc");
exit (0);
}
free (t);
}

exit (0);
}

/*
Output :
test 791000000
test 792000000
test 793000000
test 794000000
test 795000000
test 796000000
test 797000000
test 798000000
test 799000000
test 800000000
test 801000000
test 802000000
test 803000000
test 804000000
test 805000000
test 806000000
malloc: Not enough space

test 940000000 ?? second L1000 reached this
test 990000000 ?? third L1000

It is alwas reach the same values an all servers!!
*/

3 REPLIES 3
T G Manikandan
Honored Contributor
Solution

Re: 800MB malloc limit???

Please check your application executable which is running out of memory.

If the application executable or the process is 32 bit then it cannot access memory more than 960 MB.
you can enable the EXEC_MAGIC option with the executable which can make you access around 1.7GB of memory.

This should be the case with you.
you must be running a 32 bit application!!
Check the proc_mgt and mem_mgt.txt files in /usr/share/doc.

Revert
Pavel Hampl
Occasional Advisor

Re: 800MB malloc limit???

Thanks a lot for your answer. You was rigth. I have already heard about EXEC_MAGIC but my memory ... :))
Now I allowed third quadrant by : chatr +q3p enable a.out
and application can take ~ 1.8GB memory, what should be enough for a moment.


Again thanks,
Pavel
Dietmar Konermann
Honored Contributor

Re: 800MB malloc limit???

However, all those EXEC_MAGIC, q3p or similar features are only used to overcome the 32bit address space limitations. By using 64bit versions of your application all those problems should be history.

Try to build your test program using 64bit and you will see (option +DD64).

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)