libvlc_video_take_snapshot memory leak?

This forum is about all development around libVLC.
Beardless2
Cone that earned his stripes
Cone that earned his stripes
Posts: 125
Joined: 02 Feb 2007 09:53

libvlc_video_take_snapshot memory leak?

Postby Beardless2 » 22 Nov 2010 15:23

Hi,

I have an application which plays a video stream and saves a png image to file every 1 sec by calling libvlc_video_take_snapshot.

I have noticed that over time the amount of memory consumed by my app increases at a linear rate.

Looking at the source code forlibvlc_video_take_snapshot , a call to vlc_object_release (p_vout) is never made before we exit the method?


139 libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
140 const char *psz_filepath,
141 unsigned int i_width, unsigned int i_height )
142 {
143 assert( psz_filepath );
144
145 vout_thread_t *p_vout = GetVout (p_mi, num);
146 if (p_vout == NULL)
147 return -1;
148
149 /* FIXME: This is not atomic. Someone else could change the values,
150 * at least in theory. */
151 var_SetInteger( p_vout, "snapshot-width", i_width);
152 var_SetInteger( p_vout, "snapshot-height", i_height );
153 var_SetString( p_vout, "snapshot-path", psz_filepath );
154 var_SetString( p_vout, "snapshot-format", "png" );
155 var_TriggerCallback (p_vout, "video-snapshot" );
156 return 0;
157 }

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: libvlc_video_take_snapshot memory leak?

Postby Rémi Denis-Courmont » 22 Nov 2010 17:06

This bug was already fixed in recent versions.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: libvlc_video_take_snapshot memory leak?

Postby Rémi Denis-Courmont » 22 Nov 2010 17:41

I don't understand what input thread pointer you are refering to.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Beardless2
Cone that earned his stripes
Cone that earned his stripes
Posts: 125
Joined: 02 Feb 2007 09:53

Re: libvlc_video_take_snapshot memory leak?

Postby Beardless2 » 22 Nov 2010 17:46

sorry, I was looking at old source code. I have the latest now.

I do still have a memory leak with 1.1.5 however, in 4 hrs the usage in task manager has gone from 50mb to 150mb. (win xp)

Beardless2
Cone that earned his stripes
Cone that earned his stripes
Posts: 125
Joined: 02 Feb 2007 09:53

Re: libvlc_video_take_snapshot memory leak?

Postby Beardless2 » 22 Nov 2010 18:04

I have just seen a huge spike in memory usage, it has now gone from 150mb to 750mb.

The video appears to have now stopped, and i found lots of these the log

1|main|Failed to grab a snapshot
2|main|late picture skipped (4704550 > -10)
1|main|picture allocation failed
1|main|pictures leaked, resetting the heap
3|main|[0] 0 0
3|main|[1] 0 0
3|main|[2] 0 0
3|main|[3] 0 0
3|main|[4] 0 0
3|main|[5] 0 0
3|main|[6] 0 0
3|main|[7] 0 0
3|main|[8] 0 0
3|main|[9] 0 0
3|main|[10] 0 0
3|main|[11] 3 1
3|main|[12] 3 1
3|main|[13] 0 0
3|main|[14] 0 0
3|main|[15] 0 0
3|main|[16] 0 0
3|main|[17] 0 0
3|main|[18] 0 0
3|main|[19] 0 0
3|main|[20] 0 0
3|main|[21] 0 0
3|main|[22] 0 0
3|main|[23] 0 0
3|ts|transport_error_indicator set (pid=610)
3|ts|transport_error_indicator set (pid=640)
3|ts|transport_error_indicator set (pid=620)
3|ts|transport_error_indicator set (pid=610)
3|ts|transport_error_indicator set (pid=650)
3|ts|transport_error_indicator set (pid=620)
3|ts|transport_error_indicator set (pid=600)
2|ts|discontinuity received 0xa instead of 0x5 (pid=620)
2|ts|discontinuity received 0x5 instead of 0x1 (pid=600)
2|ts|discontinuity received 0x8 instead of 0x5 (pid=640)
2|ts|discontinuity received 0xa instead of 0x5 (pid=610)
2|ts|discontinuity received 0xb instead of 0xa (pid=650)
2|ts|discontinuity received 0x1 instead of 0x0 (pid=601)
2|ts|discontinuity received 0xe instead of 0xd (pid=651)
2|ts|discontinuity received 0xf instead of 0xe (pid=652)

I can post the whole log if you want

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: libvlc_video_take_snapshot memory leak?

Postby Rémi Denis-Courmont » 27 Nov 2010 18:30

Patch is welcome.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 14 guests