[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2004-11-03
17
Medium Priority
?
1,055 Views
Last Modified: 2013-12-06
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.
0
Comment
Question by:mromeo
  • 5
  • 3
  • 3
  • +5
17 Comments
 
LVL 2

Expert Comment

by:Matt_Avery
ID: 12484868
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
 
LVL 38

Expert Comment

by:wesly_chen
ID: 12485870
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
 
LVL 62

Expert Comment

by:gheist
ID: 12492341
It leaves core file after memory management errors, so you can bring it up in debuger
find / -name \*core\*
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Expert Comment

by:Panjandrum
ID: 12523116
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
 
LVL 7

Accepted Solution

by:
rugdog earned 500 total points
ID: 12526845
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
 
LVL 12

Expert Comment

by:stefan73
ID: 12535920
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
 
LVL 62

Expert Comment

by:gheist
ID: 12536237
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
 

Author Comment

by:mromeo
ID: 12536509
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
 
LVL 62

Expert Comment

by:gheist
ID: 12538350
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 12542127
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
 
LVL 12

Expert Comment

by:stefan73
ID: 12542466
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
 
LVL 62

Expert Comment

by:gheist
ID: 12545175
or sucky cc or malloc which includes bit-shift and off-by-one... (other 2^N should create problems too...)
0
 

Author Comment

by:mromeo
ID: 12545444
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 12546046
> When I change them from static to non-static,
programming error.
most likely your code overwrites the bounderies somewhere
0
 

Author Comment

by:mromeo
ID: 12547753
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 12548179
if it is single anyway, then that should not cause the problem, or am I missing something?
0
 
LVL 62

Expert Comment

by:gheist
ID: 12548442
this is HP build, so should be fine.
0

Featured Post

Technology Partners: 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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.
Suggested Courses
Course of the Month19 days, 18 hours left to enroll

873 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