Operating System - HP-UX
1833159 Members
3144 Online
110051 Solutions
New Discussion

Re: Allocation of memory greater than 1 GB in an EXEC_MAGIC binary

 
Mayank
New Member

Allocation of memory greater than 1 GB in an EXEC_MAGIC binary

2
Hi all,

I have the following piece of code:

ptr = NULL;
ptr = malloc(1024*1024*1024);
if (ptr)
perror("Malloc successful");
else
perror("Malloc unsuccessful");

My maxdsiz is set to 0x7B03A000 which is near about 2GB.
maxdsiz64bit = 0x0000000040000000
maxssiz = 0x00800000
maxssiz_64bit = 0x00800000

I am compiling the given code using the following command line string
cc +DD32 -Q -N

Still the code fails in allocating more than
900 MB of memory on my machine.
Any hint on what I may be missing?
2 REPLIES 2
Klaus Crusius
Trusted Contributor

Re: Allocation of memory greater than 1 GB in an EXEC_MAGIC binary

Do you have another free 1GB of virtual memory?
(swapinfo -m will report free vmem).

Klaus
There is a live before death!
Stefan Farrelly
Honored Contributor

Re: Allocation of memory greater than 1 GB in an EXEC_MAGIC binary


do the following command on your binary;

chatr +q3p enable

This enables a memory quadrant area, tested it, works fine now (didnt work without the above command). See man on chatr for more info on it.
Im from Palmerston North, New Zealand, but somehow ended up in London...