简体   繁体   中英

Used memory dosnt changed after get additional object from memcached

I dump all memory (jmap -histo ) after i load data from memcahced and than i load the the same data again (The data is loaded to another instance), but the used memory wasnt changed. No GC was done (i allocate 2g new size heap and check with jstat and another tools that no gc was done ). The second heap contains 2 instance from the type that I load from memcached. I compare the heap after the second load to the heap after the first load. The second heap has in any class types more instances than the first heap except [I that the second heap has less than the first one. The same of the gap (bytes) between the other classes in the heap is the same like the gap for [I.

I look on the byte code and didnt see anything suspicious. Any idea?

public static void main(String[] args) throws Throwable { 
              Object a1 = mc.get("userClient"); 
              -- get dump

             Object a11  = mc.get("userClient");
             -- get dump
             mc.shutdown();
}

If you wish to see the size of an Object on the heap, then turn off TLAB's (-XX:-UseTLAB) and monitor the change in Runtime.freeMemory() (dump is better because freememory is approximation ) while creating an object. This technique will only work for objects added to the heap, so local variables which are added to the stack wont show up.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM