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 7777885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:15:22+00:00 2026-06-01T18:15:22+00:00

I think this is a memory issue, but i’m unsure on what to do

  • 0

I think this is a memory issue, but i’m unsure on what to do here.

My issue:

I’ve nearly finished a game using cocos2d for the iphone, with retina gfx, I’ve made the app universal, and have done adjustments to make it run correctly on the iPad, mostly I use the retina spritesheets on the ipad, with a few additional images (contained inside the -hd spritesheets) to cover the edges of the screen etc.

Everything is working fine, the iPad, when in the game runs at 60fps, like on the iphone4 (i usually get about 40-50fps on iphone3g), however, occasionally, after 5 minutes or so of moving between menus on the iPad (generally, but not always, after unloading the game engine and moving back to the menus), the game falls over.

In the debugger, i get ‘Received memory warning.’, shortly after (not immediately), when a new spritesheet or graphic is loaded (not creation of a sprite, but the actually loading of a new texture into memory), the app closes and all that I get in the console is ‘(gdb)’ with no stacktrace.

I’m struggling to find a solution, when moving from my game engine to my menus, I have a loading screen, which is mostly created using 1 full screen image, and some text, all other textures, spriteframes and preloaded soundfx are then purged from memory before anything new is loaded in.

I’ve attempted to run the ipad with leaks and allocations on in instruments, but as soon as the app loads, instruments crashes every time.

Does anyone happen to know what the max memory space is for an ipad app before it closes (i thought i’d atleast get 3 warnings, not 1), and how many 2048 x 2048 sheets does that equate too?

EDIT: (New cause of irrational memory disappearance discovered!)

So, weeks later, I stumble onto this post on the cocos2d forums.

http://www.cocos2d-iphone.org/forum/topic/31092

This bug in iOS5 is likely to be the main cause of my troubles, all advice and suggestions have helped, in my opinion, to tighten up my app as a whole.

  • 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-01T18:15:23+00:00Added an answer on June 1, 2026 at 6:15 pm

    For consuming less memory. Use the CCTextureCache. Remember that Cocos2D always saves images with a width/height being a power of 2. So if your image is 513 pixels it’ll use an image with 1024 pixels.

    CCTexture2D *texture = [[CCTextureCache sharedTextureCache] addImage:@"randomImage.png"];
    CCSprite *randomImage = [CCSprite spriteWithTexture:texture];
    

    For saving even more memory you can look into using Texture Atlases. Whenever you switch to a menu or game you can call removeUnusedTextures (or when outofmemory get called).

    [[CCTextureCache sharedTextureCache] removeUnusedTextures];
    

    You can also use images in a lower quality to save memory.

    [CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA4444];
    

    Whenever you need to load higher quality images or gradients you can put it back.

    [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think this is nearly impossible or very tricky. I'm using CriteriaBuilder, JPA 2.0,
I've been having this memory leak issue for days and I think I have
I have an issue with my program using much more memory than I think
I think that this is a permissions issue but I am not sure and
I THINK this line is causing a 3.5K Byte memory leak, any ideas why?
What do you think? Is this correct or are there memory leaks? Source: #include
I think this could be a very easy question for you. But I have
(I think this is a pretty basic question on OOP, but unfortunately I wasn't
I think this is a pretty straightforward problem but... var outerHeight = $('.profile').outerHeight(); $(#total-height).text(outerHeight
I think this is mostly because I'm new to PHP OOP, but I have

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.