Where do I find a MemoryConsumer.java program to test consumption of memory? I know that such a thing already exists , as I see references via Google to such things. For example, this Oracle site refers to "ConsumeHeap.java" but I don't know where to find that source code.
hotspot 1.6 options
Does anyone know where to find or how to create such a thing?
I've used this ObjectSizer class to good effect:
http://www.javapractices.com/topic/TopicAction.do?Id=83
It works by creating huge amounts of object instances, as suggested by Tyler.
You could simply create a huge amount of object instances and keep them in scope.
ArrayList<SomeObject> listOfObjects = new ArrayList<SomeObject>;
for (int i = 0; i < aBigNumber; i++) {
listOfObjects.add(new SomeObject());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With