Xorg VRAM leak because of Qt/OpenGL Application

Mathieu Westphal mathieu.westphal at kitware.com
Thu Jul 12 07:27:03 UTC 2018


Hi list,

The issue was resolved thanks to an intense debugging session.

This is a Qt issue, caused by our usage of QVTKOpenGLWindow and
windowContainer.
The leak was caused by NULL parenting the parent of the windowContainer
containing the QVTKOpenGLWindow just before deletion.

This code was here before when we used a QOpenGLWidget and it caused no
issue. In any case, NULL parenting a widget before deletion is useless so
removing the line resolve the issue.

This leak shouldn't happen though, even in this situation, so I have opened
a Qt issue <https://bugreports.qt.io/browse/QTBUG-69429> to report it.

Sorry for the noise, as Xorg is probably not to blame.



Mathieu Westphal

On Tue, Jul 3, 2018 at 8:14 AM, Mathieu Westphal <
mathieu.westphal at kitware.com> wrote:

> Hi Dennis, Aaron,
>
> Firstly, Dennis, you may have missed that it is *Xorg *leaking in the *VRAM
> *and not releasing it even* after my application is exited*/killed
> completely.
> I have been monitoring the RAM as well, it is fine and my application is
> not leaking but somehow forces Xorg to allocate graphical memory that never
> gets released.
>
>
>>
>> > I think you are looking at output from an nvidia tool and not memory
>> > for the system and processes as a whole.
>>
> I'm using nvidia-smi as it is available on all system with the nvidia
> driver
> I actually see the same behavior monitoring NVX_gpu_memory_info
> <https://www.khronos.org/registry/OpenGL/extensions/NVX/NVX_gpu_memory_info.txt>
>  manually
>
>
>>
>> Based on Mathieu's email subject, it sounds like he's interested in how
>> much GPU memory Xorg is using. The process data in /proc does not
>> include GPU memory.
>>
> Indeed
>
>
>>
>> Mathieu, when you say memory is leaked, do you mean that the memory
>> usage increases each time you run myOpenGLQtBasedApp, or does it
>> increase from 50 MB to 110 MB and then stay there even if you run the
>> app again?
>>
> Each time I run and open/close QOpenGLWindow based widget, the graphical
> memory usage
> increase by 4Mb until it reaches 96% of the availlable VRAM.
> It then actually starts to leak on RAM by a mechanism I just learned about
> (eviction)
> And then, once the RAM is full, OpenGL fails completelly.
>
>
>> You can diagnose which clients are causing the server to allocate
>> resources by running tools such as xrestop, xwininfo -tree -root, and
>> xlsclients before and after running your app each time.
>>
> Here are my results on a test run using Xfce with compositor enabled.
> nvidia-smi shows a 61Mb leak
>
> xlsclient -l and xwininfo -tree -root outputs are strictly identical
> before and after.
> xrestop -b shows a slight increase of lees than a Mb all process
> additionned.
> (see attached)
>
> Note : Even after multiples runs and hundreds Mb of memory leaked reported
> by nvidia-smi,
> xrestop total memory usage does not increase.
>
>
>>
>> If you're still having trouble, you can email linux-bugs at nvidia.com and
>> we can try to help you out there.
>>
> I definitely will if we can't figure out what is going on.
>
> Best regards,
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg/attachments/20180712/69334220/attachment.html>


More information about the xorg mailing list