A question about glDeleteTextures
Hello happy coders !
I'm working on a game with lots of png textures and I'm experiencing crashes because I'm running out of memory.
I use code similar to GLSprite to load a png, and use glDeleteTextures when I don't need the texture anymore.
With Instruments I can see memory usage is increasing at load time but is not decreasing when I delete textures.
Is there something more to do when deleting textures ?
Is there a way to check memory usage when running on a device i.e. without Instruments ?
Thanks
I'm working on a game with lots of png textures and I'm experiencing crashes because I'm running out of memory.
I use code similar to GLSprite to load a png, and use glDeleteTextures when I don't need the texture anymore.
With Instruments I can see memory usage is increasing at load time but is not decreasing when I delete textures.
Is there something more to do when deleting textures ?
Is there a way to check memory usage when running on a device i.e. without Instruments ?
Thanks
Fred9000 Wrote:Hello happy coders !
I'm working on a game with lots of png textures and I'm experiencing crashes because I'm running out of memory.
I use code similar to GLSprite to load a png, and use glDeleteTextures when I don't need the texture anymore.
With Instruments I can see memory usage is increasing at load time but is not decreasing when I delete textures.
Is there something more to do when deleting textures ?
Is there a way to check memory usage when running on a device i.e. without Instruments ?
I have seen a similar topic somewhere.
Make a loop that will create and destroy same texture many times, and watch for memory usage.
ShiftZ Wrote:I have seen a similar topic somewhere.
Make a loop that will create and destroy same texture many times, and watch for memory usage.
Hello ShiftZ
I did. Memory doesn't seem to increase with a single texture. But, according to Instruments, memory is allocated 3 times :
one time with gldGetTextureLevelImage, another with gfxAllocateTextureLevel
and also with CoreGraphics img_data_lock.
So it could be quite huge for a 1024*1024 png texture !
My first game on AppStore : here
Actually it seems like loading a texture with :
spriteImage = [UIImage imageNamed:name].CGImage;
is caching the file, and using memory.
It's better to use :
NSData *texData = [[NSData alloc] initWithContentsOfFile:path];
UIImage *image = [[UIImage alloc] initWithData:texData];
spriteImage = image.CGImage;
spriteImage = [UIImage imageNamed:name].CGImage;
is caching the file, and using memory.
It's better to use :
NSData *texData = [[NSData alloc] initWithContentsOfFile:path];
UIImage *image = [[UIImage alloc] initWithData:texData];
spriteImage = image.CGImage;
My first game on AppStore : here

