IVRSystem::GetProjectionMatrix() memory leak when called repeadedly with varying parameters
If IVRSystem::GetProjectionMatrix() is called with varying near and far plane configurations, vrcompositor.exe will use up more and more memory, and never return it. When it is called every frame with an unique far plane distance, vrcompositor.exe will eat up gigabytes of memory in seconds.
This shouldn't cause issues in most cases, but may become a problem if an application is doing something like dynamically adjusting the far plane.
Tested on Windows 10 with SteamVR version 1.20.3
The implementation of this function locks and reads some shared memory, does some math, and returns the result. it doesn't interact with vrcompositor in any way. It seems unlikely that it would cause unbounded memory growth in vrcompositor. More likely what is happening is that vrcompositor is growing its memory use at the same time by coincidence.
Maybe those same depth values are being passed along with eye buffers in a VRTextureDepthInfo_t struct, and the varying values there are somehow causing vrcompositor's memory to grow?
Does the growth continue forever, or does it eventually level out? How many GB does the compositor get up to?
Can you provide a system report after you've reproduced this?
I tried reproducing it but couldn't. I can't remember exactly how it was set up though, but I think I had it isolated to a simple case where I just incremented the input values without using the matrix.
I was using the matrix for calculating the passthrough camera projection, and calling GetProjectionMatrix() separately from the main rendering pass. I think the issue manifested when I was calculating the near and far planes based on the passthrough projection each frame in some way that made the values fluctuate.
I think the compositor memory went up to about 13 GB and leveled out after that, although I'm not sure.