GNOME Bugzilla – Bug 720408
cluttersink leaks memory with yuv video
Last modified: 2013-12-16 14:01:22 UTC
cluttersink leaks memory when gets video in format other than RGB, it seams memory is not freed after unreffing the cluttersink element. Reproduced on 2.0.8 and 1.6.0 Sorry, I don't know yet how to fix it, I suppose there are some cogl handles not freed, because after some time I get this: Cogl-WARNING **: Over 50 separate fragment shaders have been generated which is very unusual, so something is probably wrong! Cogl-WARNING **: Over 50 separate vertex shaders have been generated which is very unusual, so something is probably wrong! Cogl-WARNING **: Over 50 separate programs have been generated which is very unusual, so something is probably wrong! Also I have a test source code that reproduces this: http://pastebin.com/asNfUhPQ Thanks, Vladimir
This a Cogl problem. I had a chat with the Cogl developers about this warning and it turns out Cogl never destroys previously created shaders. I had the same problem with a live shader editor (in my case it showed up pretty quickly). I'm reassigning to the Cogl component. Not sure if there will be a solution in the short term.
Created attachment 264167 [details] [review] video-sink: use a shader cache Meanwhile we can use a local shader cache to avoid leaks.
Thanks, it works fine on Linux and Windows. I found one more problem clutter-gst-video-sink.c, but I'm not sure if it's a bug or not (maybe I should file a new bug): material_template is unreffed in _create_template_material if it exists but it not unreffed in dispose or finalize. Thanks, Vladimir
Created attachment 264285 [details] [review] Proposed fix for the hash keys There is a problem with the patch provided because the source (shader) string is not always const, e.g. it is malloced and freed in clutter_gst_yv12_fp_init and clutter_gst_i420_fp_init. Thanks, Vladimir
(In reply to comment #3) > Thanks, it works fine on Linux and Windows. > I found one more problem clutter-gst-video-sink.c, but I'm not sure if it's a > bug or not (maybe I should file a new bug): material_template is unreffed in > _create_template_material if it exists but it not unreffed in dispose or > finalize. I tried to unref it myself, but the result is that after a while my test application is crashing, I suppose I am wrong. Sorry. > > Thanks, > Vladimir
Thanks for spotting that, I'm pushing you patch upstream.