Operating System - HP-UX
1832359 Members
2559 Online
110041 Solutions
New Discussion

HPUX 11.00 memory use or leak

 
Michael Burbury
Frequent Advisor

HPUX 11.00 memory use or leak

Hi all,

I've been running "swapinfo -a" every hour in a cron sript and recording the percentage of memory used. It is slowly creeping up and has gone from 41% a few days ago to 54% today.
(Swap is still 0%, I only record memory)

Is there any way to tell which process is gradually consuming the memory?
(I do not have glance)

Thankyou for your help.
6 REPLIES 6
Con O'Kelly
Honored Contributor

Re: HPUX 11.00 memory use or leak

Hi Michael

The memory line in swapinfo refers to pseudo_swap, so that it only shows that the % of memory reserved by processes is increasing. In my opinion this is really not an issue (unless it continues to keep growing) As more processes are started on the server, more swap space needs to be reserved, hence this figure will increase. Its inevitable that it will fluctuate.

I'd be more concerned with monitoring Free Memory on your system.

Without Glance you can use:
# vmstat 1 2| tail -1 | awk '{printf "%d\n", ($5*4)/1024}'

Additionally you may suspect a program has a memory leak. The thread from a few days ago has excellent info on identifying memory leaks.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x1ec8d7d96cbad711900a0090279cd0f9,00.html

I've attached a HP Doc on swap.

Cheers
Con


James R. Ferguson
Acclaimed Contributor

Re: HPUX 11.00 memory use or leak

Hi Michael:

First, swap is going to be *reserved* when a process allocates [malloc()s] memory but has yet to write to it. You can see this reflected in 'swapinfo'. Once this memory is written to, the *used* component shown in 'swapinfo' will increase accordingly. Most importantly, if the process free()s the memory it has allocated, *no* change in the used fraction will occur until the process which performed the original allocation actually terminates. At that point, only, memory is returned to the operating system. Thus, over time, a gradual decrease in available memory is not unexpected.

If you suspect that a program has a memory leak (at application coding error!), then run the following cmmand periodically and watch for growth in the process size:

...[to target a specific process by its command basename]:

# UNIX95= ps -C thebasename -o "user,vsz,pid,ppid,args"

,,,or, [to watch all processes by descending process size]:

# UNIX95= ps -e -o "user,vsz,pid,ppid,args" | awk 'NR>1' | sort -rnk2

In both cases, the blank (space) character after the equal sign and before the 'ps' command sets the UNIX95 option for the command line only.

Regards!

...JRF...
Steven E. Protter
Exalted Contributor

Re: HPUX 11.00 memory use or leak

Swap is not a good indicator of a memory leak.

Every time a process opens swap gets reserved.

Here are some data collection scripts that might help.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Tim Adamson_1
Honored Contributor

Re: HPUX 11.00 memory use or leak

Hi,

If you install the latest q4 patch (it differs depending on the OS), there is a utility in /usr/contrib/Q4/bin called kmeminfo. Run the utility and it will give you an idea of where your memory is going.

As a general rule, look at the percentages going to kernel and user applications. If the kernel is too high, look at the break down and see which component of the kernel is the culprit. For the dynamic area, you will need to look at the buckets/arenas and they are typically fixed by patches.

If the user apps is high, run the utility with the -user option and see which application is the biggest consumer.

Give it a go. It is a very handy utility.


Cheers!!!
Yesterday is history, tomorrow is a mystery, today is a gift. That's why it's called the present.
Michael Burbury
Frequent Advisor

Re: HPUX 11.00 memory use or leak

Hi all,

I am monitoring with a lot more information now and tracked down the process which "grows" on it's memory usage.

Thankyou for everyones help, it has been invaluable as usual :)
Michael Burbury
Frequent Advisor

Re: HPUX 11.00 memory use or leak

Hi all,

FYI: it was HPapache2 V2.0.43.05 and specifically the httpd daemon when running with SSL enabled. If I disable SSL it does not "grow" in it's memory usage.

I am upgrading it to V2.0.45 and in the mean time I have a cron script that re-starts HPapache2 each midnight.

Thankyou for everyones help and a search on this ITRC forum has turned up quite a few good scripts and tools for monitoring our system.

I especially like the "psstat", "shminfo" and "memcheck" C programs I found - a special thankyou to the authors.

If only I could get this level of support on my SUN box :)