There some MTLTextures of which histogram is to be calculated, this textures changes at every loop iteration so calculation of histogram is carried out in loop using MPSImageHistogram.
There is a single command queue on which a new command buffer is created at every loop iteration to perform histogram calculation.
Memory footprints (from allocation instrument) keeps on increasing due to new command buffer creation in the loop.
The question is how to clear the allocated memory of the command buffer once it's executed? Or is there any way for restructuring the calculation scheme?
In short, how to deallocate the memory consumed by metal objects like command buffer, compute pipeline, encoders etc.