Ticket #10972 (closed defect: fixed)
OpenGL memory leaks escape VM
|Reported by:||DzenanZ||Owned by:|
|Version:||VirtualBox 4.2.0||Keywords:||memory leak guest host|
I have written a program which heavily uses 3D rendering (VTK library). It is leaking memory when used. I don't have time to hunt down and fix these leaks. Without virtual machine in the picture, all of its allocated memory is freed when it is closed, so it can be run many times without degrading system performance.
I have tried to use it in VirtualBox with 3D acceleration enabled. It is run many times for about a minute, and then closed and started again. Usually, a few instances are running in parallel. When the program is closed, TaskManager within VM shows that memory has been deallocated.
However, this has adverse effects on the host memory system. I have set aside 4GB for VM, 256MB for VM graphics etc. When the VM is just started, total memory consumed in the host OS is around 6GB. With my program within VM being executed constantly, the memory consumption in the host OS grows, until it hits physical memory limit. In the process tab of TaksManager, VirtualBox.exe's "memory (private working set)" grows from ~100M to ~5GB in about half an hour, when the system breaks down ("close some programs to free memory" warning).
To test whether 3D acceleration was to blame, I disabled the most resource intensive rendering in my program (so it does not crash due to missing OpenGL featuers). When 3D acceleration is disabled for VM, only small amounts of memory leak in the described fashion (100x less to 1000x less).