java 垃圾对象,Java垃圾回收和大对象

本文探讨了Java中大型1500x500像素图像数组对象如何影响内存管理,指出大对象直接进入老年代,而大小决定是否跳过新生代。特别关注JRockit和HotSpot的区别,以及对象尺寸对内存分配的影响。
摘要由CSDN通过智能技术生成

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?

解决方案

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.

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值