Tuesday, 15 March 2011

java - How can cache limit size of memory used? -


Cache allows megabytes to specify the maximum size of the cache in memory. How does this apply that it does not use more than several megabytes?

For example, putting in the Java cache () method can look like this:

  put (object's object value)  

Is there an easy way to get the object size of the object object from any reference? The only way I can imagine that the image is being used to recycle the whole object structure.

In many caches it is to limit the count of objects in general, it ignores the fact that different objects are different, However, on average, it is mostly fixing memory in different quantities.

In Google Guava, you can specify an abstract weight for any object, which is used for removal decisions. See:

EACHACHE implemented an automatic resource control that cares about the object size. The engine behind this is a separate project on Gitub: See also blog posts from Alex Ssas:

It is also a general library using JVM instrumentation. If I miss it correctly, the size of the eACHACHT implements different methods, you are losing with jam if instrumentation is not available on your JVM.


No comments:

Post a Comment