I'm really interested in measuring memory usage correctly. According to link I gave, could you instruct me how did you measure real memory usage, please?
- Virtual memory is the amount of memory requested by the program, which may or may not be in use.
- Resident memory is the actual amount of memory in use.
- Shared memory is the amount of memory that can be shared with other applications or between multiple instances of the same application (this accounts for shared objects, system libraries, etc).
As a rule of thumb, low resident memory is the what you are interested in. If you have two programs with similar resident memories, the one with the highest shared memory wins. Virtual memory is not a useful metric when comparing memory usage.
Managed (GC-enabled) applications tend to have slightly inflated virtual memory values (this is done for performance reasons - the details are interesting but rather technical for this discussion). For example, .Net/win32 always requests something like 8MB of memory on application startup - even if the application is only using 2MB of those. (These extra 6MB do not actually hurt performance, i.e. they won't cause you to run out of physical memory).
Mono applications also tend to have lower shared memory values (this is a bad thing), because the runtime cannot share JIT-able bytecode. This can be improved using AOT on your binaries (AOT-ed binaries are shareable).
Leave a comment: