ios - How to find out what eats up memory in Cocos2d -


i developing game using cocos2d ios.

there scenes menu , , main game scene. on main scene there 3 dynamic objects. these objects periodically shoot @ each other (until these objects killed or moved out of scene).

now problem: game eats memory. , want find out doing wrong.

there no obvious leaks over-retained objects. scene gets dealloced, objects gets removed parents , cleaned up, animations gets stopped etc.

anyway, memory keeps going somewhere. using following code

+ (void) reportmemory {     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 kbytes): %f", info.resident_size / 1024.0);     else         nslog(@"error task_info(): %s", mach_error_string(kerr)); } 

to find how memory consumed @ each start of scene. , reported number greater previous one.

i tried use allocations profiler wasn't able figure out useful. see total living bytes same, process allocates , deallocates something.

what suggest me at? basically, seeking advices how debug memory operations in case.

edit (what have helped me):

it turned out had nszombieenabled turned on. basically, main factor constant memory consumption increases. useful information , tip can found in @coneybeare answer

the second useful thing use instruments (leaks , allocations) @jack suggested. helped me find couple of subtle leaks.

instruments absolutely friend, eats memory able see it.

first thing should use leaks instrument (which not allocation one) show leaks sampling memory every x seconds.

if click specific recognised leak can see

  • in a responsible call chain leak found
  • by clicking small arrow in b can see exact living progression of memory leaked (like when has been malloc'd, retained, released , whatever)

leaks xcode

if not enough, choosing allocations instruments, have button on left labeled mark heap. button creates snapshot of heap everytime clicked , able show exact differences, able see if there memory allocated , never released between 2 moments in there shouldn't any.

enter image description here

with these i've been able find memory related issue!


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -