[quote='871886022, pbantolas, /thread/812419?answerId=871886022#871886022, /profile/pbantolas']
That's my guess, worth adding a reset at the end to see if it fixes it. Still sounds like a bug so consider reporting it!
[/quote]
Good point. Tried reset()-ing but didn't do much. Also, printing the allocator's allocatedSize() shows constant ~2.5MiB
There was no point really in doing this, it was mostly me playing with the Metal 4 API. If this is a legal program it should not leak is my position.
It has to be the buffer. This version works and does not leak:
func draw(in view: MTKView) {
guard let drawable = view.currentDrawable else { return }
commandQueue.waitForDrawable(drawable)
commandQueue.signalDrawable(drawable)
drawable.present()
print(self.allocator.allocatedSize())
self.allocator.reset();
}
but this version of draw does:
func draw(in view: MTKView) {
guard let drawable = view.currentDrawable else { return }
commandBuffer.beginCommandBuffer(allocator: allocator)
commandBuffer.endCommandBuffer()
commandQueue.waitForDrawable(drawable)
commandQueue.commit([commandBuffer])
commandQueue.signalDrawable(drawable)
drawable.present()
print(self.allocator.allocatedSize())
self.allocator.reset();
}```
Both of those aren't fully working though, as the view does not display its clear color.
Something's not working right, I think. I'll file a bug.