Memory leak happening with gstatomic queue

Nicolas Dufresne nicolas.dufresne at collabora.com
Sat Nov 22 06:03:31 PST 2014


Le 2014-11-21 05:34, HK a écrit :
> recv_thread ()
> {
>     uint8* data;
>     GstBuffer *buf;
> while (1) {
>      data = recv_data();
>      buf = gst_buffer_try_new_and_alloc(SIZE);
>      GST_BUFFER_SIZE (buf) = SIZE;
>      memcpy((GST_BUFFER_DATA (buf)), data, SIZE);
>
>      gst_atomic_queue_push(Context->atqueue, buf);
> }
> }
>
>
>
> // CREATE METHOD
> src_create(GstBuffer **buffer)
> {
>         GstBuffer *buf;
>
>         buf = gst_atomic_queue_pop(Context->atqueue);
>         *buffer = buf; ( this will give the buffer to base src )
> }
>
> As per my understandig, I am giving the GstBuffer created in my thread to
> base source and base source should unref it. But I am having heavy memory
> leak in this.
> Could someone suggest what is going wrong ?

 From my understanding, your recv_thread() might be queuing faster then 
the BaseSrc thread is pushing. I would say, figure-out a way to 
synchronize the two threads, or even better, just call recv_data() in 
src_create().

Nicolas



More information about the gstreamer-devel mailing list