Sign in to follow this  
mrkarate

Panda ios memory problem

Recommended Posts

hi!, I just have a weird problem, and just on ios (I think android gave more memory to browser resources).

 

I have a dinamic game, with a dinamic map, so I generate a tileset of 26x25 tiles (100x100 each tile), and then  I tried two things:

that container, I convert to cache as bitmap, and when the player got to the final of that tileset, I cacheasbitmap = false the container, remove all sprites, and then add a new tileset (but from same tileset family, only change order, and all tileset are added on start), and make cacheasbitmap again, the other method I use, is instead of cacheasbitmap that tileset container, I add tileset too, but use the generateTexture() method, and to delete it, I use texture.destroy() method.

 

The two methods works, I have 1 draw call per tileset instead of 400, so thats very nice. THE PROBLEM!!, is, no matter what I do, on ios, (on iphone 6 plus!! so it's not a limited ios device), when I generate, the 6 or the 7 tileset, the browser crash and restart,

and I already check and have sure is this method that crash, because I try to only generate 5 of this segments of tileset, and then no generate more, only move on the last one, and the game don't crash, so I think, whatever I do, removing this sprites, or destroy the texture, I think the engine doesn't really remove from memory, have someone this problem before??

 

really thanks!

 

Share this post


Link to post
Share on other sites

well... finally can't find a solution, every time I make a generateTexture or cacheAsBitmap, it's like memory never release, so finally the game will crash (on mobile, obiosly), no matter what what thing I do to delete cache, texture, memory etc... so finally I create a method to culling my tiles, yes, this will generate more draw calls than use only one big sprite, but, incredibble, my performance it's not worst, I think maybe a little, but no more 1-3 fps less, and this way, my game never crash, always use same memory,

 

Still don't know why the hell the are generateTexture and cacheAsBitmap methods, if you can't use them n times??, maybe you need to unload all cache memory? (but this means reset all your game),

really don't understand it, hope someone can explain it.

 

thanks!

Share this post


Link to post
Share on other sites

The "cacheAsBitmap" should destroy the texture after set to true, I don't know why it does not work. If you want to completely destroy a texture, you need to call:

texture.destroy(true);

This also destroys its baseTexture.

Try to destroy the texture generated by using "generateTexture" and see whether the memory is released.

Share this post


Link to post
Share on other sites

yes, I already do that, as I commented it (sorry if I wrote like shit haha, my english it's not good), but I try to delete the baseTexture and the texture, with destroy, using generateTexure, and using cacheasBitmap too, with generateTexture, I see how the sprite using that texture, becoming a black square, so I see how the baseTexture is deleting, then asign null to that texture, with cacheAsBitmap, I, try to set to null, all sprites become again, (no longer a bitmap), and remove every one, but after 6 or 8 times of generate this textures the browser crash (it's same effect If I generate this textures at same time, it's for this I can be sure this bitmaps don't remove from memory, no mather what destroy or other method I use.

 

I can check too, it's not a ios problem, on android too, but android has a lot memory assigned to the browser ( on android I can generate about 15-20 of this textures), so really can't do more,

 

You can check my game right?, I generate a long tile base divided maps before, now I use every tile as a single draw call, but with a smart culling control, so the performance I gained using a single bitmap, is equally to now, instead of the extra draw calls.

 

 

thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.