• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MIDP heap problem

 
Ankur Shah
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the middle of my MIDlet program I'm getting an "heap out of memory message" do you know what I could do to alleviate this situation.
Ankur
 
Eric Giguere
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your app is using too much memory. You need to either (1) create less or smaller objects, or (2) free more objects. Most of the standard Java techniques for reducing the memory footprint of an application apply: instantiate objects lazily, help the garbage collector (null out unused references early and often), etc. Shameless plug: I discuss these kinds of things in both my J2ME books. But really, any good book on Java application optimization will also cover the material.

------------------
Eric Giguere
author/co-author of:
Mobile Information Device Profile for Java 2 Micro Edition: Professional Developer's Guide
Java 2 Micro Edition: Professional Developer's Guide
PalmTM Database Programming: The Complete Developer's Guide
 
liang gu
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an interesting and similar problem. The same application runs fine on the Palm VIIx device and never craches. But on Handspring Visor Edge(which is a newer device and has much more memory than Palm VIIx), the application craches quite often. This leads me think that there are bugs either on the device or on the KVM. Can anybody give me some suggestion how to solve the application crashing problem on Handspring Visor/Edge device? Thanks.
Liang
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic