Hello Guest

Author Topic: Out of memory?  (Read 4482 times)

Grebenots

  • Newbie
  • *
  • Posts: 9
    • View Profile
Out of memory?
« on: April 20, 2013, 01:28:05 am »
I have a massive amount of large sprites in my app, about 300 separate 512x512 textures as well as some 2048x1536 backgrounds.  At any rate, I'm getting app crashes, which I'm guessing is because of a memory problem.

Is there any way around this?  Everything is running fine on the computer, but the app crashes without an error on iOS devices.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Out of memory?
« Reply #1 on: April 21, 2013, 12:12:23 am »
You don't say what you're doing in game when you get these crashes? These atlases aren't all loaded in automatically, unless you use them in a scene. And if you are loading them all in at the same time, then you're probably out of luck as all of them will not be able to be resident in memory at the same time - you'll just run out of memory. You will almost certainly need some form of memory management to handle this kind of volume.

The good news is its definitely doable, the bad news is I need to know what you're doing to make any relevant recommendations :)

Grebenots

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Out of memory?
« Reply #2 on: April 24, 2013, 01:04:55 am »
This is in relation to http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,1251.msg7357.html#msg7357 as well.

I am basically making a tile matching game with a metric ton of large tiles.  There is a flash card mode where you can just cycle through the tiles.  Everything is split between different tile packs, but if the user switches to all the tile packs, eventually the device runs out of memory.

This can definitely be solved with unloading atlas data when the user changes tile packs, but how do I do that?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Out of memory?
« Reply #3 on: April 24, 2013, 10:35:53 am »
Replied in the other post.
That method should work fine for now - and perhaps well enough for your game too. The upcoming API function I mentioned is for when you want to fully manage the sprite collections lifecycle, but if you're just swapping packs of cards UnloadUnusedAssets might suffice.