shm interface problems

Olivier Crête olivier.crete at collabora.com
Wed Jan 16 11:22:01 PST 2013


On Wed, 2013-01-16 at 10:34 -0800, Remco Treffkorn wrote:
> On Wednesday, January 16, 2013 12:16:43 Olivier Crête wrote:
> > Hi,
> ...
> > I suggest allocating a
> > new buffer every time you want to send.. and discard it after having
> > called sp_writer_send_buf().
> > 
> 
> Hi,
> 
> I was wondering about that. Do you mean allocating a new buffer call sp_writer_send_buf()
> and then free the buffer. Call alloc and do it again?
> 
> Freeing the buffer makes it available for reallocation. I might just get the same physical
> memory on my next alloc call. Why not just re-use and save the overhead of free/alloc?
> 
> Sorry if I am dense, but it is still very cold...

Because when you call  sp_writer_send_buf(), it actually gives a pointer
to that buffer to the receiver, and it will only be available for re-use
once the receiver is done with it. Otherwise you risk over-writing it
while the receiver is reading.

-- 
Olivier Crête
olivier.crete at collabora.com



More information about the gstreamer-devel mailing list