Class MemoryEstimator
java.lang.Object
com.loomcache.server.cache.MemoryEstimator
Estimates memory usage of cache entries and maps.
Uses both shallow and deep estimates for accuracy.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> long Estimate memory for a ConcurrentHashMap.static longestimateEntrySize(Object key, Object value) Estimate total memory for a single map entry (key + value + overhead).static longestimateMapSize(DistributedMap<?, ?> map) Estimate total memory consumption of a DistributedMap.static <K,V> long estimateMapSize(Map<K, V> map) Estimate memory for a generic Map.static longestimateObjectSize(Object obj) Estimate the size of a single object in bytes.
-
Constructor Details
-
MemoryEstimator
public MemoryEstimator()
-
-
Method Details
-
estimateObjectSize
Estimate the size of a single object in bytes. Handles String, arrays, and generic objects. -
estimateEntrySize
-
estimateMapSize
Estimate total memory consumption of a DistributedMap. -
estimateConcurrentHashMapSize
Estimate memory for a ConcurrentHashMap. -
estimateMapSize
Estimate memory for a generic Map.
-