Java Garbage Collection and big objects

随声附和 提交于 2019-12-24 08:55:54

问题


I have rasters in my program of approximately 1500x500 pixels. Each pixel is represented with a float. I believe that means that 1500x500x4(bytes) = 3 million bytes or 3mb. They can be bigger than this. Does the Java Garbage Collector treat big objects differently than smaller ones? Do they skip into a higher generation automatically?


回答1:


Larger objects can be placed straight into tenured space. The size of the individual objects is what matters e.g. float[1500][1500] is 1500 objects which are 1500*4 (plus overhead) each.

http://blog.dynatrace.com/2011/05/11/how-garbage-collection-differs-in-the-three-big-jvms/

This suggest JRockit does place large objects into tenured space but doesn't say anything about HotSpot.


This suggests large objects have to be larger than the young generation space to go directly into tenured space.

https://blogs.oracle.com/jonthecollector/entry/size_matters



来源:https://stackoverflow.com/questions/11397949/java-garbage-collection-and-big-objects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!