Shelby's Blog

Friday Feb 08, 2008

Changing the amount of shared memory a program can use on AIX

On AIX mmap competes with memory available for malloc.  If the program is compiled with -bmaxdata:0x80000000, allowing the program to malloc 8 segments of memory (8x256 MBytes = 2 GB; one memory segment equals 256 M bytes.), then the program can only mmap file of 1 memory segment size (it cannot be zero).  If maxdata is 6 then it can mmap 2 segments, assuming that the EXTSHM environment variable is not set.  If the environment variable is set, 3 additional segments are available.  So when maxdata = 8, the process can mmap 3 segments; and when maxdata = 6, the program can mmap 5 segments.
To change the number of memory segments a program uses one can run the following command:

/usr/bin/echo '\0060\0\0\0' | dd of=execcutable_name bs=4 count=1 seek=19 conv=notrunc

This sets the flag to 3 in the finished executable. The values for different maxdata settings are as follows:
8 = '0200\0\0\0'
7 = '0160\0\0\0'
6 = '0140\0\0\0'
5 = '0120\0\0\0'
4 = '0100\0\0\0'
3 = '0060\0\0\0'
2 = '0040\0\0\0'
1 = '0020\0\0\0

Calendar

Feeds

Search

Links

Navigation

Referrers