Xorg VRAM leak because of Qt/OpenGL Application

Aaron Plattner aplattner at nvidia.com
Tue Jul 3 05:28:30 UTC 2018


On 07/02/2018 09:22 AM, Dennis Clarke wrote:
> On 07/01/2018 10:11 PM, Mathieu Westphal wrote:
>> Hello list,
>>
>> I am working on a complex Qt/OpenGL Application.
>> Xorg starts leaking in VRAM when i'm using the application and never
>> release the memory, until I restart X of course.
>>
>> $ nvidia-smi
> 
> I think you are looking at output from an nvidia tool and not memory
> for the system and processes as a whole.
> 
>> The version of Xorg does not matter, tested a few.
>> The version of the driver does not matter, as long as it's nvidia,
>> tested 340, 384, 390
> 
> Using 384.98 here.  Very stable.
> 
> However I think you are looking at output from nvidia-smi here and not
> actual process data from the /proc/$PID/stat where $PID is the pid of
> your X process.

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.

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?

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.

If you're still having trouble, you can email linux-bugs at nvidia.com and
we can try to help you out there.

-- Aaron

> For example :
> 
> sed$ ps -ef |  grep "bin\/X"
> root      2488  2429  3 Jun15 tty1     13:32:18 /usr/bin/X :0
> -background none -noreset -audit 4 -verbose -auth
> /run/gdm/auth-for-gdm-TVlXTy/database -seat seat0 -nolisten tcp vt1
> 
> sed$ cat /proc/2488/stat
> 2488 (X) S 2429 2488 2488 1025 2488 4202752 15866906 3576 170 0 4111107
> 762600 6 3 20 0 2 0 4079 569253888 46342 18446744073709551615 1 1 0 0 0
> 0 0 3149824 1098933967 18446744073709551615 0 0 17 1 0 0 1192 0 0 0 0 0
> 0 0 0 0 0
> sed$
> 
> The actual rss ( Resident Set Size ) is what you should have a look at.
> According to PROC(5) you can get that from "stat" under /proc for a
> given pid. That is field 24 here :
> 
> sed$ cat /proc/2488/stat | awk '{ print $24 }'
> 46342
> 
> These are pages of memory and that reports :
> 
>     Resident Set Size: number of pages the process has in real memory.
>     This is just the pages which count toward text, data, or stack
>     space.  This does not include pages  which  have  not  been
>     demand-loaded in, or which are swapped out.
> 
> 
> Your page size may be 8192 bytes or 4096 bytes or something else:
> 
> sed$ getconf -a | grep "PAGE"
> PAGESIZE                           4096
> PAGE_SIZE                          4096
> _AVPHYS_PAGES                      95456
> _PHYS_PAGES                        8187584
> 
> nix$ getconf -a | grep "PAGE"
> PAGESIZE                           65536
> PAGE_SIZE                          65536
> _AVPHYS_PAGES                      89121
> _PHYS_PAGES                        95356
> 
> 
> So while the nvidia-smi tool may seem to tell you that a process needs
> more memory in the GPU it isn't telling you much about the process
> running on your system.
> 
> sed$ nvidia-smi -q -d POWER,TEMPERATURE,PIDS
> 
> ==============NVSMI LOG==============
> 
> Timestamp                           : Mon Jul  2 17:17:10 2018
> Driver Version                      : 384.98
> 
> Attached GPUs                       : 1
> GPU 00000000:86:00.0
>     Temperature
>         GPU Current Temp            : 40 C
>         GPU Shutdown Temp           : 102 C
>         GPU Slowdown Temp           : 97 C
>         GPU Max Operating Temp      : 80 C
>         Memory Current Temp         : N/A
>         Memory Max Operating Temp   : N/A
>     Power Readings
>         Power Management            : Supported
>         Power Draw                  : 16.28 W
>         Power Limit                 : 110.00 W
>         Default Power Limit         : 110.00 W
>         Enforced Power Limit        : 110.00 W
>         Min Power Limit             : 100.00 W
>         Max Power Limit             : 130.00 W
>     Power Samples
>         Duration                    : N/A
>         Number of Samples           : N/A
>         Max                         : N/A
>         Min                         : N/A
>         Avg                         : N/A
>     Processes
>         Process ID                  : 2488
>             Type                    : G
>             Name                    : /usr/bin/X
>             Used GPU Memory         : 218 MiB
>         Process ID                  : 13211
>             Type                    : G
>             Name                    : /opt/firefox/firefox
>             Used GPU Memory         : 21 MiB
>         Process ID                  : 32110
>             Type                    : G
>             Name                    : /opt/firefox/firefox
>             Used GPU Memory         : 21 MiB
>         Process ID                  : 32668
>             Type                    : G
>             Name                    : /opt/firefox/firefox
>             Used GPU Memory         : 2 MiB
> 
> sed$
> 
> Cute .. but not your actual process memory usage in your system.
> 
> Dennis



More information about the xorg mailing list