I've recently been looking to reduce instances of dynamic memory allocation, and I noticed that my drawHUD function (which is called each frame) generates some memory with each call, which builds up over time and eventually must be garbage collected. Curious as to why, I decided to compare memory snapshots in visual studio, and I discovered that each instance of SpriteBatch.Draw is generating a small amount of memory. According to the snapshots, one call to SpriteBatch.Draw generates an additional 4 counts of "HandleCollector+HandleType", and an additional 1 count of "SharpDX.Direct3D11.ShaderResourceView". While I recognize that in isolation these calls are generating negligible amounts of memory, the type of game I'm working on requires a consistently smooth framerate, so I'd really like to avoid any unnecessary buildup of garbage. Is the memory generated during SpriteBatch calls unavoidable, and if so, are there any tips for minimizing memory usage in the rendering process as a whole?
EDIT: I have also just discovered that memory usage increases very rapidly while moving the mouse around over the game window, or holding a key down. A bit of research suggests that this may be due to the underlying behavior of Winforms or OpenTK. I'm seeing the same results as described in this github issue, https://github.com/MonoGame/MonoGame/issues/3662 though the issue was ultimately closed.