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 #18

Open
rvsemenov opened this issue Jul 30, 2015 · 1 comment
Open

memory leak #18

rvsemenov opened this issue Jul 30, 2015 · 1 comment

Comments

@rvsemenov
Copy link

   in void NDKHelper::HandleMessage(json_t *methodName, json_t* methodParams)

  CCObject *dataToPass = NDKHelper::GetCCObjectFromJson(methodParams);
  //dataToPass retain count 1

  if (dataToPass != NULL)
          dataToPass->retain();
  //dataToPass retain count 2

        CCFiniteTimeAction* action = CCSequence::create(CCCallFuncND::create(target, sel, (void*)dataToPass), NULL);

        target->runAction(action);//without retain and release


  if (dataToPass != NULL)
          dataToPass->autorelease();
        //dataToPass retain count 2 autorelease_count 1

And When i get data in me method

   void  method(CCNode *sender, void *data){
   }

data have retain count 2 autorelease_count 1
Need remove one retain

@jasonchin
Copy link

I found this as well, seems like the fix is either changing the first retain to autorelease and delete the autorelease at the bottom, or to change the second autorelease to just release. Can anyone confirm?

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

2 participants