GNOME Bugzilla – Bug 711847
vtenc: huge memory leaks
Last modified: 2014-07-04 12:57:17 UTC
Created attachment 259564 [details]
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.
Sounds like something you also want to report to Apple :)
(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.
Any news here? Where's the mail to the cocoa-dev list? :)
(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.
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.
*** Bug 729308 has been marked as a duplicate of this bug. ***
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..
BTW, have you tried leaving the dataPtr to NULL but using the correct callback signature?
(In reply to comment #8)
> BTW, have you tried leaving the dataPtr to NULL but using the correct callback
Yes, but it does not help.