views:

186

answers:

3

Hi,

I've a JME application running in a samsung i617 cell phone, and the applications is throwing OutOfMemoryError when its heap goes over 7.1 MB (and the cell phone has 64 mb)...

Is it possible to use the -Xmx and -Xms parameters in JME

+5  A: 

No, this isn't possible. Max heap size is device dependent. See also this question.

The total memory of the handset is irrelevant. The JVM (or better the KVM) has only access to a part of it. The total amount varies from handset to handset. It could also be a restriction for the total memory a single MIDlet can access.

kgiannakakis
A: 

Try using WeakReferences and WeakHashMaps (e.g. on cacheable objects) to use as much memory as you can without throwing OutOfMemoryError. It adds some pain developing but provides a nice balance between memory usage and performance.

streetpc
WeakReferences does not axist on JavaME as it is based on an older version of Java
QuickRecipesOnSymbianOS
Huh true, exists in J2ME-CDC but not in CLDC. My mistake.
streetpc
A: 

Just for the record WeakReferenecs are supported on CLDC 1.1 javadoc (can't make comments yet, sorry...)

rjlopes