Cocos2d update leaking memory

Posted by Andrey Chernukha on Game Development See other posts from Game Development or by Andrey Chernukha
Published on 2012-08-17T14:53:48Z Indexed on 2012/11/22 11:15 UTC
Read the original article Hit count: 267

Filed under:
|
|

I have a weird issue - my app is leaking memory on device only, not on a simulator. It is leaking if i schedule update method anywhere, on any scene. It is leaking despite update method is empty, there's nothing inside it except NSLog. How can it be? I have even scheduled update on the very first scene where it seems there's nothing to leak, and scheduled another empty and it's leaking or not leaking but allocating something, the result is the same - the volume of the memory consumed is increasing and my app is crashing soon. I can detect the leakage via using Instruments->Memory->Activity Monitor or with help of following function:

void report_memory(void) 
 {
  struct task_basic_info info;
  mach_msg_type_number_t size = sizeof(info);
  kern_return_t kerr = task_info(mach_task_self(),
                           TASK_BASIC_INFO,
                           (task_info_t)&info,
                           &size);
  if( kerr == KERN_SUCCESS ) 
  {
     NSLog(@"Memory in use (in bytes): %u", info.resident_size);
  } 
  else 
  {
     NSLog(@"Error with task_info(): %s", mach_error_string(kerr));
  }
}

Can anyone explain me what's going on?

© Game Development or respective owner

Related posts about iphone

Related posts about cocos2d