Solved

How to find the memory usage of a multithreaded process (on AIX)!?

Posted on 2001-06-26
8
2,064 Views
Last Modified: 2013-12-06
Hi,

I have this program which runs for days and allocates a lot of RAM. Often I start getting No-Memory errors in the program (new() failed) even when programs like "top" or "ps" show the memory usage to be less than available memory.  I would like a way to let the program figure out it's own memory usage, and if possible , the maximum amount of memory it can allocate at any point of time.

The program is compiled as a 32 bit executable on a 64 bit AIX 4.3 machine. The available memory is 12Gb, my program starts having failed new() allcoations around 1.4Gb (close to but not yet at the 2Gb limit for the 32 but program).

Any help at all would be welcome. Any insights into how 32 bit programs memory allocation is dealt with in a 64 but enviro !?
0
Comment
Question by:ngoel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 6229867
How much swap is available? Typically on a Unix OS the kernel will use brk() to swap out the task when it is necessary to increase the in-core size of the task as memory is allocated by malloc(). Because brk() is expensive, a sizeable chunk (much larger than the outstanding malloc()) is allocated. So if swap isn't large enough to hold the task and any other swapped out tasks you'll get the "out of memory error" even when there is free memory on the system when the kernel needs to increase the size of the task.
0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6232735
Also what about ulimit -m (memory any one process is allowed)?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6241199
did you check with vmstat?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ngoel
ID: 6266942
ulimit is not a problem, my 32 bit application can theoretically allocate 2Gb and small test applications on that system actually allow a "new" of that size.

Actually for some reasons, I am not sure that the OS is reporting the correct memory usage (through PS or TOP), that is why I wanted some way of figuring out memory usage from *within* the program itself. Is there any way ?

Moreover, there is plenty of swap space (there is even tons of real memory available) because as I said, I am running this on a 64 bit machine with tons of ram and swap space, my 32 bit application cannot even physically address all that RAM available.

So if there was some way of seeing the available memory from the process's eyes (whatever way the 32bit emulation works), then I would like to know.
0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6269228
sbrk(0) will return the current max addressible location for the process.  That doesn't mean you actually get to use that whole mem space, though, since it's laid out with some bits set aside for the stack, some for shated memory segments, some for memory mapped files, etc.  You can easily hit the 2gb limit without having 2gb of usable memory for your process.
0
 
LVL 20

Expert Comment

by:jmcg
ID: 10329502
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0
 
LVL 20

Expert Comment

by:jmcg
ID: 10329517
I would have expected to see an answer that spoke specifically about the memory model used for 32-bit applications on AIX.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 10361320
PAQed, with points refunded (300)

Computer101
E-E Admin
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
linux  centos   virtualization network quetion 6 89
Correct syntax to upload file in a script using sftp 2 107
Python Assistance 7 97
swp file in unix 16 42
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question