简体   繁体   English

如何增加 Java ME 中的堆大小?

[英]How to Increase heap size in Java ME?

Is there any way to increase the heap size for Java ME on a device?有什么方法可以增加设备上 Java ME 的堆大小吗? I'm developing an application for a Nokia N95, but am bumping into memory issues when I try to do image processing of larger images.我正在为诺基亚 N95 开发应用程序,但在尝试对较大图像进行图像处理时遇到内存问题。 The phone has plenty of heap space available, but seems to restrict the amount allowed to be used by Java ME to 1MB.手机有足够的可用堆空间,但似乎将 Java ME 允许使用的空间限制为 1MB。

Short answer: No.简短的回答:没有。

Longer answer: Heap-size is hardcoded in device VM.更长的答案:堆大小在设备 VM 中被硬编码。 If you are running out of memory you need to split you task into more smaller sub tasks to allow GC to kick in. With limited memory only limited operations are possible.如果内存不足,则需要将任务拆分为更小的子任务,以便 GC 启动。内存有限,只能进行有限的操作。 You figure...你想...

On some J2ME handsets setting Midlet-Heap-Size jad attributes works.在某些 J2ME 手机上,设置 Midlet-Heap-Size jad 属性有效。 Say a handset has only 2MB heap, setting this jad attribute to say 3MB increases the Heap to 3MB.假设手机只有 2MB 堆,将此 jad 属性设置为 3MB 会将堆增加到 3MB。 You can try this out, it worked on very few handsets for me though.你可以试试这个,虽然它对我来说适用于很少的手机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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