Page 1 of 1

Stream to memory with libvlc_video_set_callbacks, possible memory leak

Posted: 28 Jan 2019 22:30
by algrev
I am testing a way to get RGB matrix from a RTSP stream with the Python (3.6) code at https://pastebin.com/CuVh2DgY

Tested on several Environments:
1) OSX Mojave 10.14.1, VLC 3.0.4
2) Ubuntu 16.04/18.04, VLC 3.0.4
3) A docker container on the mac in 1), running Ubuntu 16.04 image

In case 1) and 3), the memory of python/docker soars high in a short time and the code blows up. However, in 2) the code runs with very low memory usage for a long time.

Similar behaviors can be reproduced with C++ code with identical logic.

Any comments, solutions or workarounds of this problem will be appreciated! Thanks!

Re: Stream to memory with libvlc_video_set_callbacks, possible memory leak

Posted: 29 Jan 2019 16:50
by Rémi Denis-Courmont
LeakSanitizer ?

Re: Stream to memory with libvlc_video_set_callbacks, possible memory leak

Posted: 29 Jan 2019 18:34
by algrev
Just tested by adding -fsanitize=address to g++ compiler option on OSX. No leak is detected, but memory consumption still goes up to 1.5G after playing ~1000 frames.

Refer to http://www.voidcn.com/article/p-ofvdtpnv-bgn.html or https://github.com/berak/facereco/blob/ ... apture.cpp for an idea of the C++ code I use for testing.

Re: Stream to memory with libvlc_video_set_callbacks, possible memory leak

Posted: 29 Jan 2019 22:19
by Rémi Denis-Courmont
1.5 G with address sanitizer looks suspiciously little, actually.

Just abort the program while running. There should be a lot of leaks - but it should be obvious which one(s) are massive and which ones are just a side effect of aborting.

Re: Stream to memory with libvlc_video_set_callbacks, possible memory leak

Posted: 29 Jan 2019 23:17
by algrev
Alright, Sanitizer caught something. The following happens, but not always:

The log is too long to paste here. See https://pastebin.com/29Rv3Trh

Regardless of whether this happens, the memory issue still seems to be there.

Re: Stream to memory with libvlc_video_set_callbacks, possible memory leak

Posted: 30 Jan 2019 19:27
by Rémi Denis-Courmont
That's a crash. I don't see the link with the initially reported problem.

This is too vague. I cannot help you and I doubt anybody else can.

Re: Stream to memory with libvlc_video_set_callbacks, possible memory leak

Posted: 30 Jan 2019 21:13
by algrev
Sorry I know this is a dumb question, but what kind of test and log info shall I post here to make the discussion productive?

By "aborting the program while running", do you mean something like sending a kill -SIGABRT? Doing that on a mac will lead to a crash report generated. Will that be anything helpful?

Re: Stream to memory with libvlc_video_set_callbacks, possible memory leak

Posted: 28 Jun 2019 10:00
by Tibweizh
Hi algrev,

I'm facing the same problem, did you find something ?

Thanks