How can I tell if HP-UX 11.00 is running out of memory?

I am running an application on an HP-UX 11.00 machine, and the app crashes in unexpected places with no stack trace.  It seems to crash when I allocate mem on the stack and/or do memcpy, strcpy, etc.  Are there tools that I can use to determine if the system is running out of memory while the app is running?
Thanks.
mromeoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Matt_AveryCommented:
Does HPUX have an equivalent of Solaris "truss" or Linux "strace" commands, which give a trace of system calls made by an application?

This kind of output is quite useful when diagnosing crashes, and requires less time and effort than running a debugger (IMO).
0
wesly_chenCommented:
Hi,

   There is strace (/usr/bin/strace) in HP-UX.

   However, I think the system crashs because the memory manipulation done by the apps. Not run out of memory.
Run out of memory will casuse the apps to crash, not system to crash.

Wesly
0
gheistCommented:
It leaves core file after memory management errors, so you can bring it up in debuger
find / -name \*core\*
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

PanjandrumCommented:
Glanceplus should do it all.
 
"GlancePlus provides immediate performance information about your system. It lets you easily examine system activities, identify and resolve performance bottlenecks, and tune your system for more efficient operation"
0
rugdogCommented:
do vmstat , check the sr (scan rate field) it should be mostly 0, if its too high (say greater that 150) then you have memory shortage. Alternatively, you could also do  a ps -e -opid,vsz,comm to check how much memory the processes are consuming and see if is close to the VM size.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stefan73Commented:
Hi Panjandrum,
Yes, GlancePlus is a good choice for a free system monitor. I especially like the various bottleneck alerts. Good tool.

Cheers!

Stefan
0
gheistCommented:
Could you provide shortest code that causes such crashes, I will try to explain what is wrong with memory allocations. Your hardware and OS seems fine till now.
0
mromeoAuthor Commented:
It would be quite difficult to post the code.  Not only is it multi-threaded, but it also both a client and server.  The strange part about the code is that I re-use a define to allocate memory on the stack that is usually set to 8192.  If I change that size to 5000, the program does not crash.  If it is 8192, it crashes every time.  Since the 8192 ends on a word boundary, I suppose it could be an off-by-1 error.   But I also think that I may be running into a memory limit.  How do I find out what the max stack size is?
0
gheistCommented:
Look at your routine for off-by-one, which includes all bit shift operations too ....

ulimit -a tells the limit as command
getrlimit and setrlimit for program control ( increasing limits is for root )
0
ahoffmannCommented:
please post results of (depending on the shell):
  limit
or
  ulimit -a
when logged in as the user which runs your app
8192 bytes should not be a memory problem
0
stefan73Commented:
Sounds like you're running out of stack. Check if you can define your variable static (only if the function isn't recursive). See if this helps.

Another alternative is to increase the stack size. I don't know how the default limits are in HPUX, but their probably similar to Solaris (8MB). This requires root privileges, and many admins don't like to do this - so try the static approach first.
0
gheistCommented:
or sucky cc or malloc which includes bit-shift and off-by-one... (other 2^N should create problems too...)
0
mromeoAuthor Commented:
I do have a class method that has some static variables.  When I change them from static to non-static, the program crashes.  My static size is 8192K.
0
ahoffmannCommented:
> When I change them from static to non-static,
programming error.
most likely your code overwrites the bounderies somewhere
0
mromeoAuthor Commented:
I just noticed that when I type g++ -v, I get the following information:

Reading specs from /a/local/pa20_32/lib/gcc/hppa2.0w-hp-hpux11.00/3.4.2/specs
Configured with: ../src/configure --enable-languages=c,c++ --prefix=/usr/local/pa20_32 --with-local-prefix=/usr/local/pa20_32 --with-gnu-as --with-as=/usr/local/pa20_32/bin/as --with-ld=/usr/ccs/bin/ld --disable-shared --disable-nls
Thread model: single
gcc version 3.4.2


is the Thread Model "single" correct?  
0
ahoffmannCommented:
if it is single anyway, then that should not cause the problem, or am I missing something?
0
gheistCommented:
this is HP build, so should be fine.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.