Assuming I have a class that does some heavy processing, operating with several collections. What I want to do is to make sure that such operation can\'t lead to out-of-memo
I can think of several options:
You can also write your own benchmark test which counts memory. The idea is to
System.gc(), memoryBefore = runtime.totalMemory() - runtime.freeMemory()System.gc(), memoryAfter = runtime.totalMemory() - runtime.freeMemory()This is a technique I used in my lightweight micro-benchmark tool which is capable of measuring memory allocation with byte-precision.