Xcode 12.4, iOS 14.4
I'm debugging my app's memory footprint and it seems like the allocated sizes for a large number of textures don't make sense with what their actual sizes should be. I found this other post that describes a very similar issue: https://developer.apple.com/forums/thread/668963
For me, the "Textures" section of the gpu frame capture reports 305mb total, but hovering the mouse indicates 8075 resources taking 805mb. Looking at the resources section, I can see a lot of small textures taking up 128kb instead of their normal size. Most of these textures should only be around 1kb to 16kb (32x32 to 128x128 dimensions, various ASTC block sizes, mostly sRGB 12x12).
When putting a breakpoint at the newTextureWithDescriptor: call where they are allocated, I can see that the resulting MTLTexture is being allocated out of a "_masterBuffer" that is 128kb, and the image itself has a _masterBufferOffset and a _length that make sense. Eg: _masterBufferIndex = 14, _masterBufferOffset = 30976, _length = 896. However, looking at this exact texture in the frame capture shows an "allocated size" of 128kb.
I suspect this inflated amount is being used for the xcode memory gauge, since the app is getting killed when loading into a large level due to memory usage. In the other forum thread, they mentioned a fix was in progress. Are there any updates about that? Otherwise, is there something I can do to make these numbers more sane?
I'm debugging my app's memory footprint and it seems like the allocated sizes for a large number of textures don't make sense with what their actual sizes should be. I found this other post that describes a very similar issue: https://developer.apple.com/forums/thread/668963
For me, the "Textures" section of the gpu frame capture reports 305mb total, but hovering the mouse indicates 8075 resources taking 805mb. Looking at the resources section, I can see a lot of small textures taking up 128kb instead of their normal size. Most of these textures should only be around 1kb to 16kb (32x32 to 128x128 dimensions, various ASTC block sizes, mostly sRGB 12x12).
When putting a breakpoint at the newTextureWithDescriptor: call where they are allocated, I can see that the resulting MTLTexture is being allocated out of a "_masterBuffer" that is 128kb, and the image itself has a _masterBufferOffset and a _length that make sense. Eg: _masterBufferIndex = 14, _masterBufferOffset = 30976, _length = 896. However, looking at this exact texture in the frame capture shows an "allocated size" of 128kb.
I suspect this inflated amount is being used for the xcode memory gauge, since the app is getting killed when loading into a large level due to memory usage. In the other forum thread, they mentioned a fix was in progress. Are there any updates about that? Otherwise, is there something I can do to make these numbers more sane?