I donot see anywhere in Put function of Cache , that the sizeof Object or anything similar to it is being called . So how does ehCache comes to know the current memory filled. I know there are other function to get that , but they need to be called explicitly. I want to know at the runtime , how does it know the memoey filled.
答案 0 :(得分:0)
首先,如果配置为这样,Ehcache将只对堆上的对象进行大小调整。如果是,则调整大小发生在堆内存储中,ARC相关代码不在Cache.put
方法中。
因此,如果您想要追踪代码,请从net.sf.ehcache.store.MemoryStore#put
开始,另请参阅net.sf.ehcache.pool.impl.AbstractPoolAccessor#add(java.lang.Object, java.lang.Object, java.lang.Object, boolean)
。