Post not yet marked as solved
Post marked as unsolved with 0 replies, 131 views
I'm having trouble with memory leaks.
I want to get shader's reflection data from MTLFunction which is generated from precompiled shader files.
These files are compiled with Metal Developer Tools for Windows 2.3 and I use the following command options.
-x metal hoge.metal -std=ios-metal2.0 -o hoges.msl
To get these reflection data, I use the function newArgumentEncoderWithBufferIndex:reflection:.
I can get the reflection data, but some memory leaks occur for each call this function, and I don't know how to release the memory of the reflection data.
This is a example code.
void Func(id<MTLFunction> _pShaderFunc)
{
MTLAutoreleasedArgument reflection = nil;
id<MTLArgumentEncoder> argEnc = [_pShaderFunc newArgumentEncoderWithBufferIndex:0
reflection:&reflection];
// some process...
// [reflection release]; // run-time error.
[argEnc release];
}
I tested this on iPhone 11 Pro Max with iOS 13.3.1, Xcode 13.1, and Mac mini(2018) with macOS Monterey 12.4.
I compiled source files specifying the option -fno-objc-arc.
I used the instrument Leaks, and I confirmed when this function isn't called, there were no memory leaks.
Could you give me some advice on how to resolve those leaks?