Leaks in libvlc via VLCKit for tvOS

This forum is about all development around libVLC.
ssbmaccom
Cone that earned his stripes
Cone that earned his stripes
Posts: 184
Joined: 26 Nov 2015 15:21
Operating System: Mac OS, iOS, tvOS

Leaks in libvlc via VLCKit for tvOS

Postby ssbmaccom » 21 Jul 2017 09:13

With latest version (committed yesterday by Felix) of VLCKit I have seen many crashes of my App on tvOS.
I see the message: debugger ended with memory issue.

So I prepared an Instruments runs searching for leaks I like to share with you. There are a lot of leaks. after 30 seconds running just one stream I have more than 1900 leaks with about 5 MB.

Please review them. You can get the trace file for Instruments at http://www.schmidt-bilkenroth.de/vlcleaks.trace.zip

Regards,

SSB

ssbmaccom
Cone that earned his stripes
Cone that earned his stripes
Posts: 184
Joined: 26 Nov 2015 15:21
Operating System: Mac OS, iOS, tvOS

Re: Leaks in libvlc via VLCKit for tvOS

Postby ssbmaccom » 21 Jul 2017 15:37

These are the locations, where the leaked blocks are allocated. This might ease your analyzis, esp. when you can't open the trace file created by Instruments.
First number in original is the frame number - I have replaced this with the number of leaked blocks.

Code: Select all

4 vuplusTV 4.08 MB aligned_alloc /Users/ssb/Projekte/ssb/AppleTV/_VLCKit/VLCKit/libvlc/vlc/compat/aligned_alloc.c:47 1972 vuplusTV 801.12 KB picture_NewFromResource /Users/ssb/Projekte/ssb/AppleTV/_VLCKit/VLCKit/libvlc/vlc/src/misc/picture.c:218 2 vuplusTV 2.53 KB vout_display_opengl_New /Users/ssb/Projekte/ssb/AppleTV/_VLCKit/VLCKit/libvlc/vlc/modules/video_output/opengl/vout_helper.c:639 6 vuplusTV 320 Bytes DecodeBlock /Users/ssb/Projekte/ssb/AppleTV/_VLCKit/VLCKit/libvlc/vlc/modules/codec/videotoolbox.m:1076 2 vuplusTV 96 Bytes generic_init /Users/ssb/Projekte/ssb/AppleTV/_VLCKit/VLCKit/libvlc/vlc/modules/video_output/opengl/converters.c:1105 1 vuplusTV 16 Bytes Open /Users/ssb/Projekte/ssb/AppleTV/_VLCKit/VLCKit/libvlc/vlc/modules/video_output/ios.m:181 2 vuplusTV 32 Bytes ToLower /Users/ssb/Projekte/ssb/AppleTV/_VLCKit/VLCKit/libvlc/vlc/modules/text_renderer/freetype/platform_fonts.c:445
The last one could potentially be fixed with this patch:

Code: Select all

diff --git a/modules/text_renderer/freetype/fonts/darwin.c b/modules/text_renderer/freetype/fonts/darwin.c index a3ea832954..b460afe72f 100644 --- a/modules/text_renderer/freetype/fonts/darwin.c +++ b/modules/text_renderer/freetype/fonts/darwin.c @@ -195,6 +195,7 @@ end: CFRelease(coreTextFontDescriptorsArray); CFRelease(familyName); + free(psz_lc); return p_family; }
I will investigate the others as well...

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Leaks in libvlc via VLCKit for tvOS

Postby Jean-Baptiste Kempf » 24 Jul 2017 16:13

Fixed, for this one.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

ssbmaccom
Cone that earned his stripes
Cone that earned his stripes
Posts: 184
Joined: 26 Nov 2015 15:21
Operating System: Mac OS, iOS, tvOS

Re: Leaks in libvlc via VLCKit for tvOS

Postby ssbmaccom » 26 Jul 2017 20:54

I checked after last update by Felix, but now there is a deadlock when stopping playback. Log stops with a message like „closing module ios“ or similar. The debug message inside ios.c vout module is not reached.

i check again with a fresh sandbox (git speed requires patience) and if this is not showing the deadlock, I will comment here.

ssbmaccom
Cone that earned his stripes
Cone that earned his stripes
Posts: 184
Joined: 26 Nov 2015 15:21
Operating System: Mac OS, iOS, tvOS

Re: Leaks in libvlc via VLCKit for tvOS

Postby ssbmaccom » 10 Aug 2017 13:00

After circumventing the deadlock I was also able to switch back to use the shared libvlc instance inside VLCKit, as the new version has the pass-through property. Well I need to check it, but yes... this allows me not to pass options when creating the mediaplayer instance.
Now also many leaks have disappeared, but some are still left. It is not eating up too many bytes, but these are still leaks:

The objects that leaked were created here (Instruments is giving this info):
  • Malloc 32 Bytes 2 < multiple > 64 Bytes vuplusTV DecodeBlock
    at DecodeBlock /Users/ssb/Projekte/ssb/AppleTV/_VLCKit/VLCKit/libvlc/vlc/modules/codec/videotoolbox.m:1083
  • Malloc 16 Bytes 3 < multiple > 48 Bytes vuplusTV Open
    at Open /Users/ssb/Projekte/ssb/AppleTV/_VLCKit/VLCKit/libvlc/vlc/modules/video_output/ios.m:183
  • Malloc 32 Bytes 2 < multiple > 64 Bytes vuplusTV DecodeBlock
    at DecodeBlock /Users/ssb/Projekte/ssb/AppleTV/_VLCKit/VLCKit/libvlc/vlc/modules/codec/videotoolbox.m:1083
  • CFDictionary 2 < multiple > 128 Bytes vuplusTV DecodeBlock
    at DecodeBlock /Users/ssb/Projekte/ssb/AppleTV/_VLCKit/VLCKit/libvlc/vlc/modules/codec/videotoolbox.m:1069
  • CFData 2 < multiple > 320 Bytes vuplusTV DecodeBlock
    at DecodeBlock /Users/ssb/Projekte/ssb/AppleTV/_VLCKit/VLCKit/libvlc/vlc/modules/codec/videotoolbox.m:1076
When interested I can share the trace file saved from Instruments.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 19 guests