HELP! Memory issue... :(

Hi, we try to run the game in iOS Device (iphone5s) but we have this error:

Received memory pressure event 16 vm pressure 0

Message from debugger: Terminated due to memory issue

from a scene to other.

Some people could help us? Many thanks (we need to send the game :tired_face:

INFO: Every scene has flag “Auto Release Assets” at true and we load the scene with:

        cc.director.preloadScene(cc.gameData.level.currentLevelName, function (error, asset) {

on android we don’t have this trouble, why??? :frowning: :cold_sweat:
Thanks for help!

INFO: Screenshot from iOS profiler… the memory comes to 245mb and after the system crash… how is possible? the new scene don’t have so many texture :frowning:

we use cocos 2.2.2 but the trouble is also 2.3.3 :frowning:

help please!

@Big_Bear Hi, is it possible that the texture from texturepackar (so the atlas) is not released when we change the scene? Thanks.

Is there web mobile or native app ?

native app (iOS)

What if you set ‘Async load assets’ on scene ?

we don’t have tried with async load :confused: is a possible solution? maybe the system release the unused texture when create the new scene? we use only cc.director.preloadScene and after cc.director.loadScene…

i know that , if you set “auto release assets” and don’t do manage your assets by self, it cause errors of load next scenes. like a some assets used in more than one scene which marked as ‘auto release assets’ and you don’t load those assets by self it causes an error. it seems some assets which unloaded can’t be loaded by scene again.

but when we change the scene… cocos don’t destroy the nodes inside it? and when are destroyed they aren’t unload from memory? (see texture etc…)

use cc.sys.garbageCollect(); after release a scene.

My memory clean algorith is

  • Before load the next scene, mark the current one as auto release (just to be sure) and mark what shoud be loaded before load the next scene
  • Go to a memory-clean scene
  • Release all the assets used (I use cc.loader.releaseResDir() on specific folders)
  • Call cc.sys.garbageCollect(); to release it
  • Load the marked assets
  • Load the next scene

Do you have a little sample to do this? If this its not a trouble. :blush: many thanks for help!!

Dude, I don’t know if I can send the code here (it’s on my work’s project), better not to, sorry.

The best I can do is share that algorith.

would be great! Thanks.