nV News Forums

 
 

nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   NVIDIA Linux (http://www.nvnews.net/vbulletin/forumdisplay.php?f=14)
-   -   XvMC memory leak in 180.* / 185.* drivers (http://www.nvnews.net/vbulletin/showthread.php?t=131277)

Mike Playle 04-08-09 03:06 PM

XvMC memory leak in 180.* / 185.* drivers
 
2 Attachment(s)
Since the 180.29 driver I've been seeing a memory leak in an application I've been developing.

I've managed to cut it down to a small program (attached) which just calls OpenGL and XvMC functions which still demonstrates the problem. To reproduce the leak:

Compile and run the attached C file:

$ gcc leak.c -lX11 -lXv -lXvMC -lXvMCNVIDIA -lGL
$ ./a.out

Also run 'top' in another window, set to sort by memory usage (press the "M" key). The 'a.out' process rapidly moves to the top of the list and its memory usage (VIRT and RES columns) steadily increases. If it is allowed to run for long enough it will eventually run out of memory and crash.

I've tried driver versions 180.29, 180.44, 185.13 and 185.19, all of which have the same problem. The previous version (177.70.33) works fine for me.

I'm using Debian 4 on x86 hardware (an Acer laptop).

Can anyone else reproduce this problem?

Stephen Warren 04-08-09 05:42 PM

Re: XvMC memory leak in 180.* / 185.* drivers
 
Could you please try all the earlier 180.* releases to isolate when this happened. That'll help us locate any change that caused this. Thanks.

Stephen Warren 04-08-09 05:46 PM

Re: XvMC memory leak in 180.* / 185.* drivers
 
Actually, I don't think there's any point trying the older 180.* releases; nothing has changed for XvMC within that range that I can see. I'll file a bug.

Mike Playle 05-09-09 07:59 AM

Re: XvMC memory leak in 180.* / 185.* drivers
 
I've investigated this a bit further with the latest pre-release driver (180.53).

The leaked memory is being allocated in nv0032XvMCStatic which sends an X extension request and allocates 3 buffers to hold the reply. These 3 buffers get allocated every time round the loop, but they're only ever freed from nv0137XvMCstatic which is called from XvMCDestroySubpicture, XvMCDestroySurface and XvMCDestroyContext. So it looks to me like these buffers are meant to be allocated once only, the first time through, just like the outer context structure.

I found a possible uninitialised variable in nv0032XvMCStatic that looks like it might be relevant. If the local at offset 0x38 from the stack pointer is non-zero then nv0032XvMCStatic just returns success without allocating the 3 buffers. However I can't find anywhere in the function where this local gets initialised. Could this have anything to do with the leak?

Stephen Warren 05-11-09 04:01 PM

Re: XvMC memory leak in 180.* / 185.* drivers
 
FYI, we've repro'd the issue and are working on a fix.

Stephen Warren 05-13-09 11:32 AM

Re: XvMC memory leak in 180.* / 185.* drivers
 
This should be fixed in the next 185.* driver release.

AaronP 05-13-09 01:13 PM

Re: XvMC memory leak in 180.* / 185.* drivers
 
Quote:

Originally Posted by Stephen Warren (Post 2004219)
This should be fixed in the next 185.* driver release.

I don't think this is actually the case -- there's a new 185.* driver coming soon that doesn't have this fix. It'll be fixed in the release after that.

jyavenard 05-13-09 08:01 PM

Re: XvMC memory leak in 180.* / 185.* drivers
 
Quote:

Originally Posted by Stephen Warren (Post 2004219)
This should be fixed in the next 185.* driver release.

What about the stable 180.x drivers ?

Stephen Warren 05-14-09 12:52 AM

Re: XvMC memory leak in 180.* / 185.* drivers
 
I don't believe the fix is slated for 180.*

Mike Playle 05-29-09 01:43 PM

Re: XvMC memory leak in 180.* / 185.* drivers [FIXED]
 
Verified fixed in 185.18.14. Thank you very much! I'll give it a stress test overnight.


All times are GMT -5. The time now is 02:20 AM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.