posted 13 years ago
I recently wrote a small program that extensively uses Collections. And while I was profiling this for memory utilization on my local machine, I found something wierd happening. To measure memory util, I gave sysouts with totalMemory()-freeMemory() (invoked on the Runtime instance).
At the end of a run, I get the following statements on console:
There were 7 iterations of this loop in total.
Notice the output in bold.. The memory used upto this point was constant and then there's a sudden spurt of close to 80 Bytes. I have two questions..
1. Why is the memory usage constant over the first 4 iterations, till the section in bold? I mean, shouldnt there be a progressive increase if any?
2. Why the spurt?