gourav dhiman gourav dhiman - 1 year ago 149
Java Question

How to get the used amount of memory of heap in EHcache?

Actually i want to know the occupied memory by cache. It will give me the element count in the size not the used space. So how to get it??

Answer Source

The getStatistics() method of net.sf.ehcache.Cache will give the information of used memory in bytes.

StatisticsGateway stats = cache.getStatistics();
stats.getLocalHeapSizeInBytes();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download