GNOME Bugzilla – Bug 347304
Massive leaks with xvimagesink
Last modified: 2006-07-13 14:40:32 UTC
It seems that a fair bit of memory is leaked when changing uris using playbin and xvimagesink. Attaching a test program which plays a file repeatedly using playbin. Watching the memory consumption of this, it seems to leak something on the order of 10MB at each cycle. The same thing doesn't happen with ximagesink or fakesink.
Created attachment 68815 [details] player test application
Created attachment 68825 [details] [review] Patch So, it turns out that xvimagesink was _never_ correctly releasing buffer_alloced buffers, resulting in leaking all the shared memory segments. fixing that exposed a bug where buffers returned to the sink at the exact moment it was shutting down might remain in the buffer pool, and cause crashes later when the sink is reused. This patch fixes that by using locks to protect the XContext and the 'running' variable, so that the buffer_finalize method isn't racy with respect to what the sink is doing. Patch fixes the same problem in ximagesink. It also fixes a not-so-small caps leak in decodebin exposed by valgrind.
Maybe a duplicate of bug 344259?
*** Bug 344259 has been marked as a duplicate of this bug. ***
Certainly is, thanks! It also raises the point that we should look at filesrc, although an fd leak is small enough that I'm fazed about punting it until after the release.
OK, committing based on feedback on IRC.
* gst/playback/gstdecodebin.c: (find_compatibles): Fix a caps leak when linking (#347304) * sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize), (gst_ximagesink_ximage_destroy), (gst_ximagesink_xcontext_clear), (gst_ximagesink_change_state): * sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy), (gst_xvimage_buffer_finalize), (gst_xvimagesink_check_xshm_calls), (gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put), (gst_xvimagesink_xcontext_clear), (gst_xvimagesink_change_state): Don't leak shared memory resources. Use the object lock to protect against the xcontext disappearing while returning a buffer from the pipeline. (#347304)