If you are trying to optimize your own program memory, I suggest you use a memory profiling tool. There are many there ... some of them are free, some of them ... you will surely find the one you need. These tools are written specifically for what you need (as well as to search for memory leaks), so ... it will be difficult to compare and do something like this yourself from your own program :)
source
share