views:

248

answers:

1

Some Java mobile devices have distinct heaps for MIDP and VM. What's the distinction between these two heaps, and how can a J2ME app control which is used for a given piece of data?

+2  A: 

You can't control which one is used by your MIDlet, it's decided by the implementation of the KVM (and thus by the producer). Usually, when the device has two separate heaps it uses one to keep "common" data and the other to keep media like pictures or video clips, but again, it's up to the producer, you can't force an object to be allocated on a heap instead of another via J2ME

Stefano Driussi
'Control' is too strong a word in this case, I guess. The question is really how the KVM determines which objects are media and suitable for loading into the appropriate (larger) heap, and how a J2ME app can encourage this process to take place correctly...
Adrian
Even if there was a tricky way to manipulate the heap into doing what you want, it would differ for each manufacturer. I know from experience that just battling heap fragmentation requires different approaches for different handsets.
Fostah