Projects > cpp > Issues > Bug #3899

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

Uncontrolled memory consumption (probably leak) while doing nothing!

Bug #3899 [Closed]
unoave 2014-02-07 01:55 . Updated over 10 years ago

I believe there is a bug in the new renderer of 3.0beta2.
When I Profile Hello cpp iOS in Xcode memory consumption increases with speed of about 100kb per second and it is never released!
After 15min of idling Hello cpp iOS consumes about 150mb of memory!
Please check it out! It is big!

zhangxm 2014-02-07 02:17
  • Assignee set to dabingnn
  • Target version set to 3.0-rc0 2014-02-07 09:34

If you create a project by tools/project-creator/, the problem will be appeared.
After debug the project, the reason of the bug is in
// Init the CCEAGLView
CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds]
pixelFormat: kEAGLColorFormatRGB565
depthFormat: GL_DEPTH24_STENCIL8_OES
preserveBackbuffer: NO
sharegroup: nil
multiSampling: NO
numberOfSamples: 0 ];

When the value of "pixelFormat" is kEAGLColorFormatRGB565, the problem appeared.
If change kEAGLColorFormatRGB565 to kEAGLColorFormatRGBA8, everything works well.

I don't know the real reason of the problem.
Then I looked up stuffs from google and I found this post.

ricardo 2014-02-08 00:56

Bug in iOS7 perhaps ?
we should fix it, or find a workaround. 150mb of memory is a LOT!

ricardo 2014-02-08 00:56

@Bin: I think that the bug you mentioned is a different one... but I could be wrong. 2014-02-08 02:50

I just downloaded iOS simulator 6.1 and took a test. The test result is :
1. kEAGLColorFormatRGBA8 works well on both iOS simulator 6.1 & 7.0.
2. kEAGLColorFormatRGB565 works well on iOS simulator 6.1, but the memory always increase on iOS simulator 7.0.

So I think it's a bug of iOS 7.0. Maybe we can suggest developers using kEAGLColorFormatRGBA8 to avoid the problem.

ricardo 2014-02-08 03:10

Thanks. Using RGBA8 will take more memory and is a bit slower.

Does this bug happen on the device as well ?
Perhaps it is only a Simulator bug. 2014-02-08 03:30

Yes, I took a test on device with iOS 7.0, the bug is not happened.
Do you mean what we should to do is telling developers it's only a bug of iOS simulator 7.0 ?

ricardo 2014-02-08 03:41


Thanks for testing it.
If the bug is not present on the device, then we should not fix it.
We only care about bugs on the device. The simulator won't run real games, so it is not important if the Simulator leaks memory.

dabingnn 2014-02-10 02:57
  • Status changed from New to Rejected

@riq @bin Issue was rejected.

unoave 2014-02-10 04:09

@riq @bin
I have tested on device too!
Bug exist on device!!! Memory allocation starts after about 5-10 seconds, just wait and you will see it!

ricardo 2014-02-10 04:34
  • Status changed from Rejected to Accepted


@unoave: which iOS version are you using ?

unoave 2014-02-10 05:29

ricardo wrote:


@unoave: which iOS version are you using ?
The only problem that test results are not stable. Sometimes it does continue allocation and sometimes not, I have no idea how to find the problem.

dabingnn 2014-02-21 15:43

The result on simulator ios 7.0, the memory consumption increase very quickly, for about 1Mb for 1 min.
I tested testCpp on iphone4s, ios 7.0 version. The memory consumption increase much slowly, about 0.1MB for 10-15seconds. And it will only increased by 0.2MB totally.
@unoave. can you give a statistic of memory consumption increase on IOS7.0.4?
As @Bin said. When I switched the format from RGB565 to RGBA8888, it will not increase any more. If we use ios6.1 simulator, the memory consumption will never increase.

dabingnn 2014-02-24 09:12

I update my ipad4 to ios 7.0.6. I can not reproduce memory leak.

ricardo 2014-02-25 18:30

good to know. thanks.

unoave 2014-02-26 03:32

Believe it or not, but I have updated to iOS 7.0.6 and can not see memory leak anymore.
Hopefully it is gone forever :)
I am very sorry if I made any trouble with this issue ticket. I think it is okay to close this issue now.

dabingnn 2014-02-26 03:45

@unoave Thank you for you feedback.

dabingnn 2014-02-26 03:46
  • Status changed from Accepted to Closed

Atom PDF

Start date:2014-02-07
Due date:
% Done:


Target version:3.0-rc0