Memory leak in CCImage_ios.mm?!

Hello guys,

I got a memory leak after using CCLabelTTF::labelWithString(…).
The leak seems to be in class “CCImage_ios.mm” at line “unsigned char* data = new unsigned char[width * height * 4];”

Something like
if (date){
delete [] data;}
doesn’t work for me.

So, does anyone see what’s going wrong??

Thx for help =)

What did you mean?
I think you can set a breakpoint and see what has happened.

Hi again,

Ok.
After debugging the CCLabelTTF Text label, I got following result:

  1. CCLabelTTF::labelWithString(“Test”, “Helvetica”, 18);
    ~~> memory leak
  2. CCLabelTTF::labelWithString, CCTextAlignmentLeft,“Helvetica”, 18);
    ~~> No memory leak

So I stepped into the labelWithString function and recognized, that the only difference is the Dimension of the size. So I tested, if the leak will occur in the second function, if I set the CCSizeMake to (0,0) - and it did!
3) CCLabelTTF::labelWithString(“Test”, CCSizeMake(0, 0), CCTextAlignmentLeft,“Helvetica”, 18);
-> memory leak

So, can you reproduce it ???
For me I can fix my leaks by setting a CCSizeMake > 0,0
But in general, it’s a bug?!

Thx for fast help =)

I will test it tomorrow. It may be a bug.
Thank you in advance.