After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 720408 - cluttersink leaks memory with yuv video
cluttersink leaks memory with yuv video
Status: RESOLVED FIXED
Product: clutter-gst
Classification: Other
Component: general
2.0.x
Other All
: Normal major
: ---
Assigned To: clutter-gst-maint
clutter-gst-maint
Depends on:
Blocks:
 
 
Reported: 2013-12-13 17:34 UTC by Vladimir Caruntu
Modified: 2013-12-16 14:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
video-sink: use a shader cache (1.87 KB, patch)
2013-12-13 18:47 UTC, Lionel Landwerlin
committed Details | Review
Proposed fix for the hash keys (1.13 KB, patch)
2013-12-16 13:53 UTC, Vladimir Caruntu
none Details | Review

Description Vladimir Caruntu 2013-12-13 17:34:56 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
Comment 1 Lionel Landwerlin 2013-12-13 17:46:56 UTC
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.
Comment 2 Lionel Landwerlin 2013-12-13 18:47:05 UTC
Created attachment 264167 [details] [review]
video-sink: use a shader cache

Meanwhile we can use a local shader cache to avoid leaks.
Comment 3 Vladimir Caruntu 2013-12-16 09:42:58 UTC
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
Comment 4 Vladimir Caruntu 2013-12-16 13:53:43 UTC
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
Comment 5 Vladimir Caruntu 2013-12-16 13:58:06 UTC
(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
Comment 6 Lionel Landwerlin 2013-12-16 14:01:22 UTC
Thanks for spotting that, I'm pushing you patch upstream.