• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.OutOfMemoryError

 
alimadhi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this error only in PALM OS device emulator
Can somebody help me how to solve this problem?
Ferdinand
 
a sanjuan
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your app is consuming too much memory, i'll say. there are tons of articles on the web on how to optimize J2ME and midlets so as to conserve resources. remember that these are small devices with constrained resources.
NOTE: you can usually change the heap size of the emulator to accomodate apps with more intensive requirements.
 
alimadhi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you,
I solved it. I changed
String to
StringBuffer and everything it's OK
Greetings
Ferdinand
 
a sanjuan
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yep, that's one of the first things to optimize, immutable objects like strings.
i've also tried to "reuse" stringbuffers:
StringBuffer x=new StringBuffer();
x.append("xxx");
..
..
..
// set length to 0 again and create new string after
x.setLength(0)
x.append("yyy");
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic