Solved

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

Posted on 2001-06-26
8
2,061 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
Independent Software Vendors: 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
UNiX Script filesystem space usage 19 79
text in table need to be center of the box 4 81
Writing a UNIX script menu allowing for multiple options. 5 91
Martian Packets Unix 5 72
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

740 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