How to reduce heap memory problems in MidP1.0

Forum for discussion on Game porting for mobile phones and j2me supported devices including device information.

How to reduce heap memory problems in MidP1.0

Postby silvercoder » Thu Oct 12, 2006 4:44 am

I have written the platform game in midp1.0, there comes the heap memory problems often, how to optimize my code to reduce heap memory exception :?:
silvercoder
 
Posts: 37
Joined: Fri Sep 29, 2006 12:02 pm

Postby smackall02a » Thu Oct 12, 2006 12:06 pm

I want to know your code clearly
smackall02a
 
Posts: 23
Joined: Fri Sep 22, 2006 11:32 am
Location: India

Postby DevelopmentTeam » Thu Oct 12, 2006 12:53 pm

The best way to avoid heap memory problems is by using the variable declaration with appropriate scope. The usage of having global variable should be reduced as much as possible. and keeping unused memery block without clearing it. In game programming the main issue is having an image in memory. Only those images which definitly has to be in the memory and the other have to be cleared regularly.
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Postby silvercoder » Fri Oct 13, 2006 5:24 am

I think there is the finalize() method, which will call often whenever the varriable is not in use, and make the memory free. Is this finalize method supported in either CLDC 1.0 or CLDC 1.1
silvercoder
 
Posts: 37
Joined: Fri Sep 29, 2006 12:02 pm

Postby DevelopmentTeam » Fri Oct 13, 2006 5:29 am

No finalize function is not there in J2ME. But you can put null value to any variable and do a System.gc().
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India


Return to Mobile Game Porting and Testing

Who is online

Users browsing this forum: No registered users and 1 guest

cron