ZhouWeikuan / cocos2d

cocos2d for android, based on cocos2d-android-0.82, and now ported from cocos2d-iphone 0.99.4. The googlecode address is here: http://code.google.com/p/cocos2d-android-1/ . There are several demos to watch.
610 stars 291 forks source link

A potential fix of slow gc #10

Closed genevictor closed 13 years ago

genevictor commented 13 years ago

Please consider if these two changes could help speed up gc by early removing strong references to potentially orphan nodes. In my testing project which a huge scene hierarchy takes up lots of memory and many actions perform within, was never garbage collected after replaced by next smaller scene. After paying a whole night with Memory Analzyer there were two findings.

  1. Some of the Nodes which performed actions in the huge scene is retained by the pool in ActionManager. After applying this fix gc really able reclaim the huge scene.
  2. CCLabel's setString uses texture.setLoader which cause strong reference in GLResourceLoader's WeakHashMap entry. I can't think of a fix, any help will be appreciated.
ZhouWeikuan commented 13 years ago

Hi genevictor, OpenGenius works on the gc problem.

Thanks, Weikkuan Zhou

2011/4/28 genevictor < reply@reply.github.com>

Please consider if these two changes could help speed up gc by early removing strong references to potentially orphan nodes. In my testing project which a huge scene hierarchy takes up lots of memory and many actions perform within, was never garbage collected after replaced by next smaller scene. After paying a whole night with Memory Analzyer there were two findings.

  1. Some of the Nodes which performed actions in the huge scene is retained by the pool in ActionManager. After applying this fix gc really able reclaim the huge scene.
  2. CCLabel's setString uses texture.setLoader which cause strong reference in GLResourceLoader's WeakHashMap entry. I can't think of a fix, any help will be appreciated.

Reply to this email directly or view it on GitHub: https://github.com/ZhouWeikuan/cocos2d/pull/10