Memory usage information of a Java Program [duplicate]
Possible Duplicate:
How to monitor Java memory usage?
My Java Program loads hash map with large number of values from the database. Is there any way through which I may know that how much memory each of my hash map is using during the program i开发者_Go百科s running.
I am aware that it may not be a constant value but any near approximation will also do. Or maybe how much memory each of the hash map consumes while it is loaded with data from Sql Server.
Thanks
If you want to estimate the size of specific data structures at runtime, Heinz Kabutz's newsletter describes how to do this using instrumentation: Instrumentation Memory Counter.
If you want an estimate use a profiler like VisualVM or YourKit.
You could estimate how large an entry key/value is and multiply it by the number of entries.
精彩评论