cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.13k stars 7.05k forks source link

Memory leak at spine jsb. #17853

Open yuriilychak opened 7 years ago

yuriilychak commented 7 years ago
  1. Run js test project included in sdk packet
  2. Press Spine Test and then press Main Menu
  3. press Sys Tests and find restartGame and press it
  4. press Spine Test
  5. memory will increase about 300kb per second until system crash. In my working project I have the same problem. How to check where the problem, or you know solution?
hussain-sohaib commented 7 years ago

Check if you are calling removealleventlistner any where. If you using spine calling removealleventlistner will cause memory leak. Remove all listners by name.

Thanks On Mon, 22 May 2017 at 14:54, Yurii notifications@github.com wrote:

  • cocos2d-x version: 3.15
  • devices test on: Mac-Mini, IPhone 6S
  • developing environments

    • NDK version: r14b
    • Xcode version: 8.1 Steps to Reproduce:
    1. Run js test project included in sdk packet
    2. Press Spine Test and then press Main Menu
    3. press Sys Tests and find restartGame and press it
    4. press Spine Test
    5. memory will increase about 300kb per second until system crash. In my working project I have the same problem. How to check where the problem, or you know solution?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cocos2d/cocos2d-x/issues/17853, or mute the thread https://github.com/notifications/unsubscribe-auth/ACC8g7iVVSe0jnmXC_eRkp4eIQFpLIM5ks5r8VtJgaJpZM4NiITY .

-- Best Regards Sohaib Hussain

yuriilychak commented 7 years ago

@hussain-sohaib what you mean by "removealleventlisteners". It spine listeners or other? For spine I only use their. this._skeleton.setStartListener(listener); this._skeleton.setCompleteListener(listener); And null it when destroy object? Mayby removeFromParent with cleanup do this?

hussain-sohaib commented 7 years ago

No no, the listner you mentioned are spine objects listner. I was talking about cocos2dx listners, like touchonebyone listner or custom listners. I faced this issue with c++ version and i resolved it by removing listners that I used in scene by name. I dont know what could be the issue in js version.

Please see spine runtime examples. But i am sure some thing wrong happens when you restart the scene. Check how spine guys are moving from one scene to another.

Thanks On Mon, 22 May 2017 at 16:02, Yurii notifications@github.com wrote:

@hussain-sohaib https://github.com/hussain-sohaib what you mean by "removealleventlisteners". It spine listeners or other? For spine I only use their. this._skeleton.setStartListener(listener); this._skeleton.setCompleteListener(listener); And null it when destroy object? Mayby removeFromParent with cleanup do this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cocos2d/cocos2d-x/issues/17853#issuecomment-303068693, or mute the thread https://github.com/notifications/unsubscribe-auth/ACC8g6mXTMn_nVT7qF_TigtBOcazNGk5ks5r8WspgaJpZM4NiITY .

-- Best Regards Sohaib Hussain

hussain-sohaib commented 7 years ago

See spine runtime examples by esoteric software the make of spine. On Mon, 22 May 2017 at 17:24, Sohaib Hussain sohaib.hussain7@gmail.com wrote:

No no, the listner you mentioned are spine objects listner. I was talking about cocos2dx listners, like touchonebyone listner or custom listners. I faced this issue with c++ version and i resolved it by removing listners that I used in scene by name. I dont know what could be the issue in js version.

Please see spine runtime examples. But i am sure some thing wrong happens when you restart the scene. Check how spine guys are moving from one scene to another.

Thanks

On Mon, 22 May 2017 at 16:02, Yurii notifications@github.com wrote:

@hussain-sohaib https://github.com/hussain-sohaib what you mean by "removealleventlisteners". It spine listeners or other? For spine I only use their. this._skeleton.setStartListener(listener); this._skeleton.setCompleteListener(listener); And null it when destroy object? Mayby removeFromParent with cleanup do this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cocos2d/cocos2d-x/issues/17853#issuecomment-303068693, or mute the thread https://github.com/notifications/unsubscribe-auth/ACC8g6mXTMn_nVT7qF_TigtBOcazNGk5ks5r8WspgaJpZM4NiITY .

-- Best Regards Sohaib Hussain

-- Best Regards Sohaib Hussain

yuriilychak commented 7 years ago

@hussain-sohaib. You mean that every event listener must have name. and when I remove every object that have some listeners I must delete they manually? And about restart of game. I use restart for update source code of game. In firs scene i have pre-preloader new build if it need and restart game when source outdated. Is it have any influince to this bug?