Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8026903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:38:16+00:00 2026-06-04T23:38:16+00:00

I am developing a game using Cocos2D for iOS. There are some scenes like

  • 0

I am developing a game using Cocos2D for iOS.

There are some scenes like menu and the like and a main game scene. On the main scene there is only three dynamic objects. These objects periodically shoot at each other (until these objects are killed or moved out of the scene).

Now the problem: the game constantly eats up memory. And I want to find out what I am doing wrong.

There are no obvious leaks like over-retained objects. Scene gets dealloced, objects gets removed from parents and cleaned up, animations gets stopped etc.

Anyway, the memory keeps going somewhere. I am 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 with task_info(): %s", mach_error_string(kerr));
}

to find how much memory consumed at each start of the scene. And reported number is always greater then previous one.

I tried to use allocations profiler but honestly I wasn’t able to figure out anything useful. I see that total living bytes are basically the same, but process constantly allocates and deallocates something.

What would you suggest me to look at? Basically, I am seeking advices for how to debug memory operations in my case.

EDIT (What have helped me):

It turned out that I had NSZombieEnabled turned on. Basically, it was the main factor for constant memory consumption increases. Some useful information and a tip can be found in a @coneybeare answer

The second most useful thing was to use Instruments (Leaks and Allocations) as @Jack suggested. It helped me to find couple of subtle leaks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:38:17+00:00Added an answer on June 4, 2026 at 11:38 pm

    Instruments is absolutely your friend, is something eats up memory then you are able to see it.

    First thing you should use is the leaks instrument (which is not the allocation one) that will show leaks by sampling memory every X seconds.

    If you click a specific recognised leak you can see

    • in A the responsible call chain where the leak is found
    • by clicking the small arrow in B you can see the exact living progression of the memory leaked (like when it has been malloc’d, retained, released and whatever)

    Leaks Xcode

    If this is not enough, by choosing the allocations instruments, you have a button on the left labeled Mark Heap. This button creates a snapshot of the heap everytime is clicked and it is able to show you the exact differences, so that you are able to see if there is memory which is allocated and never released between two moments in which there shouldn’t be any.

    enter image description here

    With these I’ve always been able to find any memory related issue!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

some friends and me are developing a game in cocos2d :), and im using
I'm developing a game using cocos2d v2.0 beta2. Since i worked with iOS5.0 all
I am currently developing a card game for the iphone using cocos2d. I am
I'm developing a game for iPhone using COCOS2D . In that, I need to
Background: I'm developing a game for the iPhone/iPad using cocos2d-iphone. Our engine provides the
I'm currently developing a game on iPhone using the Cocos2D API. It's going well.
I am developing an iphone game using cocos2d and have it set to to
I am developing iPhone 2d game by using cocos2d. I need a Picker. Is
I am developing a 2D iPhone game by using cocos2d. I need a countdown
I am developing a 2d game for iPhone by using cocos2d. I use many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.