Skip to content
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 in ScrollView #19099

Open
CarlZhongZ opened this issue Oct 9, 2018 · 2 comments
Open

memory leak in ScrollView #19099

CarlZhongZ opened this issue Oct 9, 2018 · 2 comments

Comments

@CarlZhongZ
Copy link

  • cocos2d-x version:3.17 newst on git hub
  • devices test on:all platforms
  • developing environments
    • NDK version:
    • Xcode version:
    • VS version:
    • browser type and version:

Steps to Reproduce:

  1. scroll the scrollview
  2. when the scrollview is scrolling remove the node from running scene

its member _animatedScrollAction leak

how i fix it:
ScrollView::~ScrollView()
{
if (_animatedScrollAction) {
_animatedScrollAction->release();
_animatedScrollAction = nullptr;
}
}

add the code above

@cx-github
Copy link

  • cocos2d-x version:3.17 newst on git hub

  • devices test on:all platforms

  • developing environments

    • NDK version:
    • Xcode version:
    • VS version:
    • browser type and version:

Steps to Reproduce:

  1. scroll the scrollview
  2. when the scrollview is scrolling remove the node from running scene

its member _animatedScrollAction leak

how i fix it:
ScrollView::~ScrollView()
{
if (_animatedScrollAction) {
_animatedScrollAction->release();
_animatedScrollAction = nullptr;
}
}

add the code above

i think ,you are right

@stevetranby
Copy link
Contributor

Feel free to submit a PR. Also, I would be surprised if there weren't a few more leaks of this nature. They're probably small enough that most games won't ever notice during even a long runtime, but always nice to fix even minor/infrequent leaks.
(also, there's a macro used for this)

ScrollView::~ScrollView() { 
    CC_SAFE_RELEASE(_animatedScrollAction);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants