My question is why my calculation on memory usage is much different from the VSIZE shown in "top" command?
I calculated memory usage of my c program, compiling with gcc-4.0.1 on a MacPro. The funny thing is that my calculation shows about 40MB maximum memory usage, but the largest VSIZE in "top" command for this program is about 300MB. I double-checked my calculation and was sure that it is correct. My friend told me that it might be due to gcc's memory management strategy, which might not collect garbage as long as there is memory available. It might be true, since I dynamically allocate and release a lot of memory.
Can anybody give me more suggestions? Thanks!!!
I calculated memory usage of my c program, compiling with gcc-4.0.1 on a MacPro. The funny thing is that my calculation shows about 40MB maximum memory usage, but the largest VSIZE in "top" command for this program is about 300MB. I double-checked my calculation and was sure that it is correct. My friend told me that it might be due to gcc's memory management strategy, which might not collect garbage as long as there is memory available. It might be true, since I dynamically allocate and release a lot of memory.
Can anybody give me more suggestions? Thanks!!!