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 711847 - vtenc: huge memory leaks
vtenc: huge memory leaks
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Mac OS
: Normal major
: 1.3.91
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 729308 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-11-11 14:32 UTC by Matthieu Bouron
Modified: 2014-07-04 12:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test_cvbuffer.m (1.47 KB, text/plain)
2013-11-11 14:32 UTC, Matthieu Bouron
  Details
vtenc: fix memory leak (2.33 KB, patch)
2014-06-16 10:44 UTC, Matthieu Bouron
committed Details | Review

Description Matthieu Bouron 2013-11-11 14:32:35 UTC
Created attachment 259564 [details]
test_cvbuffer.m

vtenc has huge memory leaks on OSX 10.9 (and probably on 10.8).
This is due to the fact that the callback provided to CVPixelBufferCreateWithPlanarBytes is never called even if the CVPixelBufferRef is released.

To reproduce the issue (tested on OSX 10.9):
* gst-launch-1.0 videotestsrc ! vtenc_h264 ! fakesink
* watch your memory explode

The behaviour of the CVPixelBufferRef API can also be reproduced with the attached sample code.

Note that CVPixelBufferCreateWithBytes works and calls its callback when released.
Comment 1 Sebastian Dröge (slomo) 2013-11-11 16:58:54 UTC
Sounds like something you also want to report to Apple :)
Comment 2 Matthieu Bouron 2013-11-11 17:02:52 UTC
(In reply to comment #1)
> Sounds like something you also want to report to Apple :)

Sure, i sent an email to the cocoa-dev mailing list (not sure if it's the right way to report it), i'm waiting for the email to be approved by the admins.
Comment 3 Sebastian Dröge (slomo) 2013-12-14 17:22:21 UTC
Any news here? Where's the mail to the cocoa-dev list? :)
Comment 4 Matthieu Bouron 2013-12-16 10:52:52 UTC
(In reply to comment #3)
> Any news here? Where's the mail to the cocoa-dev list? :)

http://lists.apple.com/archives/cocoa-dev/2013/Nov/msg00177.html and no response so far unfortunately.
Comment 5 Matthieu Bouron 2014-06-16 10:44:02 UTC
Created attachment 278527 [details] [review]
vtenc: fix memory leak

It seems that when the void * dataPtr given to the CVPixelBufferCreateWithPlanarBytes function is not NULL, the release callback is called when the the cv pixel buffer is released.

The documentation about this pointer only specify that it corresponds to a "plane description block". Using an arbitrary non-NULL pointer seems to fix the issues and does cause any issues so far.
Comment 6 Tim-Philipp Müller 2014-06-16 10:52:03 UTC
*** Bug 729308 has been marked as a duplicate of this bug. ***
Comment 7 Andoni Morales 2014-06-16 11:17:15 UTC
The documentation is misleading as the type in the method declaration for the release callback is CVPixelBufferReleasePlanarBytesCallback but it points later in the description to CVPixelBufferReleaseBytesCallback.

I think your patch is correct beacause we should be using a release callback with the signature of CVPixelBufferReleasePlanarBytesCallback in instead of CVPixelBufferReleaseBytesCallback..
Comment 8 Andoni Morales 2014-06-16 11:22:42 UTC
BTW, have you tried leaving the dataPtr to NULL but using the correct callback signature?
Comment 9 Matthieu Bouron 2014-06-16 11:43:53 UTC
(In reply to comment #8)
> BTW, have you tried leaving the dataPtr to NULL but using the correct callback
> signature?

Yes, but it does not help.