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.22k stars 7.06k forks source link

cocos2d-x-3.10 JS compiled version (.jsc) leaks on iPad. #15305

Open ValeryKV opened 8 years ago

ValeryKV commented 8 years ago

Hi,

Simple JS project with compiled files (jsc) and empty scheduleUpdate function leaks. It leaks about 100K every 15 seconds.

Steps to reproduce:

  1. Run Cocos.app. Create new JS project with "Precompiled Library".
  2. Open Terminal. change dir to the root of your new project where there are 'src' and 'res' folders.
  3. Compile cocos sources: "cocos jscompile -s script -d lib/script".
  4. Compile the projects sources: "cocos jscompile -s src -d lib/src"
  5. Open the project from Cocos.app in Xcode.
  6. Exclude "JS Common\script" and "Resources\src" from targets.
  7. Add new group. Add "script" and "src" from "lib" folder to new group. Make sure "Create folder reference" is selected. Click Add.
  8. Run the app on your device.
  9. Open Debug navigator and check the Memory during one minute. --> Here the app must not leak. Stop the app.
  10. Open app.js and change HelloWorldScene:
var HelloWorldScene = cc.Scene.extend({
    update:function(dt) {},
    onEnter:function () {
        this._super();
        var layer = new HelloWorldLayer();
        this.addChild(layer);
        this.scheduleUpdate();
    }
});
  1. Run command from step 4 again to recompile changes.
  2. Open Xcode. Run the app. Check the memory. --> Here the app must leak.

Regards, Valery.

minggo commented 8 years ago

@pandamicro I am not sure if it is a real bug caused by JSB new memory model. But i think you'd better take a look since it would be critical bug if it exists.