________________________________________________________________________
Applicable Environment
________________________________________________________________________
- Topic: How memory usage is broken down in showmem (-S)
- SDP: 6.5.0
- Target: Any supported target
________________________________________________________________________
Recommendation
________________________________________________________________________
Generally showmem has two strategies for calculating memory usage for the system summary (-S):
1) Scanning the asinfo entries in the system page, specifically "ram", "sysram", "imagefs" and "startup".
2) Iterating over all processes and identifying memory privately owned by each process while also keeping a list of memory not claimed by a process.
To get "System RAM", showmem gets a total of all the asinfo "ram" entries. To get "Total Used" memory, showmem first needs to determine how much memory was reserved at startup which it does by taking "System Ram" and subtracting all the memory consumed "imagefs", "sysram", and "startup" (from the asinfo entries). Showmem then calculates "Total Used" memory by adding up the memory consumed by "imagefs", reserved memory, memory privately owned by processes and memory not claimed by a process.
Finally showmem breaks down "Total Used" into "Used Private", the memory privately owned by processes, "Used Shared" any memory that weren't claimed by a process (for example shared memory that doesn't have any users) and "Other" which is memory consumed by "imagefs" and memory reserved at startup.
________________________________________________________________________
NOTE:
This entry has been validated against the SDP version listed above. Use
caution when considering this advice for any other SDP version. For
supported releases, please reach out to QNX Technical Support if you have any questions/concerns. ________________________________________________________________________