开发者

Memory usage information of a Java Program [duplicate]

This question already has answers here: Closed 11 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜