-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memory leak #150
Comments
I enabled CC_REF_LEAK_DETECTION, and I did a compare with printleaks before and after loading the creatorReader, I find there are some SpriteFrameCache and SpriteFrame which are not released |
I did a Director::getInstance ()->purgeCachedData (); and the spriteframes are not being released, I see their ref count is 2 when purgecacheddata is called |
Reporting the first leak (and fix), When creating a button, there is a child label which is created as a protectedchild node using in Ln400 of CreatorReader.cpp (button->setTitleLabel), the created Label is not set to autorelease so it will leak. |
Could you supply a test case to show the memory leak? for example to modify the default cpp-empty-test, add your code, and push it into GitHub, tell me the link. And I didn't think
So it is setted into autorelease pool |
About the button memory leak, I think it's a bug of
another way, about the animation memory leak, I will research that. Indeed, when animation loop, exist memory leak |
I think so too, but it's not a matter thing for not any sub-class inherit This comment support Markdown, so you can add a code block by markdown, not need to paste a picture for a code block. |
Without the virtual dtor, it did not call the Node destructor properly so there was a leak. |
Node's destructor is virtual, it do call the Node destructor when |
@Seohanul see commit fix loop animate memory leak ,fix PlayOnLoad loop animation leaks in PR #152 to fix the memory leak if existing a loop animation, please stop it manually, using function: // if AnimationClip is stopped, can not run it again.
void stopAnimationClip(cocos2d::Node *target, const std::string &animationClipName);
// if a "Play On Load" animation is a loop animation, please stop it manually.
void stopPlayOnLoad();
Would you like to test this fix to make sure this patch works well? just merge that PR |
Why don't you call this stop on node dtor automatically? If its playOnLoad automatically, it is done so in creator studio, it should be able to unload automatically. |
Indeed, it's reasonable, but hard to do it in this plugin, I tried. Strictly suggest to merge that PR, and have a try. |
How about |
Sorry, its a bad idea. |
thanks for your review, I hold the same idea with you. |
when I put this code in button callback, It cause memory leak.
for (int i = 0; i < 10; ++i)
{
creator::CreatorReader * creatorReader = creator::CreatorReader::createWithFilename ("filename");
}
every time, momory goes up.
how can I fix this problem?
The text was updated successfully, but these errors were encountered: