IBM Support

AIX Memory Usage - or - Who is using the memory and how?

How To


Summary

When you run low on AIX memory, before you add more, it is good to check memory use.

Objective

Nigels Banner

Steps

Common question: I see XX% of Used Memory but I don't know who is using it and how?
A simple question but there is no simple answer as memory use if complex.

nmon then hit "m" will quickly show you a few big uses of memory as below:
nmon -m output
Many system admin people talk about Computational memory (I never understood why) but with nmon on the far
right top add the Process=6.0% and System=16.2% for the computational memory=22.2%.
UNIX Inter-process Communication (IPC) is another place which can soak up large amounts of memory. Use the ipcs -m command to list the use:
ipcs output

The shared memory used by lots of applications like DB2 and Oracle - check the SEGSZ for the size.
The Owner column usually tells you what it is used for like the Oracle user for the SGA or db2inst1 for the DB2 buffer cache. Above we see the largest Shared Memory segment is ~22 MM (222696000 bytes).

Then it is down to the processes and this gets tricky. All processes running the same program file will be sharing the code pages as its read-only.  The may also be sharing some or nearly all of the data and stack pages if the processes started by a common process that then forked like for example RDBMS and things like Apache.
This is also true for the dozens of libraries that processes also need and are largely invisible to us. Due to this unknown sharing it is often the case if you add up all the memory of all the processes it is obviously much larger than memory. If you use nmon then "t" for top processes and then "4" to order in process size you see the process memory:

nmon memory output

  • Size KB = the size as found in the program file on disk.
  • Resident Set Size = how big it is in memory (excluding the pages still in the file system (like code) and some parts on paging disks)".
  • ResText column is the code pages of the Resident Set
  • ResData column is the data and stack pages of the Resident Set
If you want the full details then you need the svmon command but be warned - this tells you the full picture and it is very complicated. Even when listing the details of a single process - as you find there are a dozen combinations of memory attributes and you find your processes memory has all of them and for the dozen libraries. Remember processes have shared read-only access the programs code and their library's code so adding up the processes does not work.
DeveloperWorks its=282027

Additional Information


Other places to find Nigel Griffiths IBM (retired)

Document Location

Worldwide

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"Component":"","Platform":[{"code":"PF002","label":"AIX"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}},{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"HW1W1","label":"Power -\u003EPowerLinux"},"Component":"","Platform":[{"code":"PF016","label":"Linux"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"","label":""}},{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Component":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
12 June 2023

UID

ibm11120119