Jump to content
  • Advertisement
Sign in to follow this  
Rajiv

Out of memory error on device

This topic is 4400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am devloping 3D game using M3G API (JSR-184). my game is of 57 KB (jar size) but when I run same on my nokia-6255(CDMA) its is giving me java.lang/OutofMemoryError Game even does not start on the application. I guessed it is problem with heap size but I checked on the www.benhui.net\mobile3D site they saying NOKIA 6255 as heap size 0f 1MB then what is the case is any body help and this prob. is not related to nokia mobiles i think.

Share this post


Link to post
Share on other sites
Advertisement
There's a big difference between memory consumption and executable size. A 57KB program is easily able to consume, say, a GB of memory. (Just create a sufficiently big array at the start of the program).

So, your game uses too much memory when running. Make it use less. [wink]

Share this post


Link to post
Share on other sites
I what should i do then i am devloping a 3D game for mobile using JSR-184 in which i am creaing a 3D world.
A 57KB program is easily able to consume, say, a GB of memory. this true but i do not taking lotas of array or memory consumtion elemnts.

But i am add all the models and sprites in the initial stage
did i add my model's later not in the starting.

how to get out of this problem.

suggest plz.

Share this post


Link to post
Share on other sites
Quote:
Original post by Rajiv
But i am add all the models and sprites in the initial stage
did i add my model's later not in the starting.


That's your problem right there. Loading everything at the beginning is great if you know everything witll fit in your allowed memory space.

There are two ways to deal with your problem:

1. Only load what you need when you need it. Do you need absolutely everything from the very beginning? Probably not. You want to load only what you need for a given level, or scene, or what have you. No sense loading the model for the final boss when you're only just starting Level 1. This also means making sure that you drop all references to that memory as soon as you know you're done with it, so the JVM can (hopefully) garbage collect for you, giving you some more room to work with.

2. If you can't be selective about what is loaded and when, then reduce the complexity of your models and such. If you can get away with making a texture smaller, do it. If you can simplify a model down to fewer triangles, do it.

1 MB isn't a lot of space, so it's up to you to make the best use you can out of it.

-Auron

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!