[asterisk-dev] ast_frame allocation/free question

Kevin P. Fleming kpfleming at digium.com
Tue Nov 27 13:09:51 CST 2007


Sergio Garcia Murillo wrote:

> So if you're writting a custom application you have to take care for
> deleting the
> frames you write and the frames you read, but if you write a custom channel
> you
> don't have to worry?
> Shouldn't be better to have a general policy about it, for example the one
> that creates
> the frame has to take care of deleting it, or the one that consumes the
> frame is the one
> that  deletes it. Just as an idea, as I said before I've just made
> everything static and
> fixed my problem.

So what is your definition of 'consume'? The application you are writing
is the one that is 'consuming' the frames. If ast_write() was the
consumer, then you'd never be able to write the frame to more than one
location without duplicating it, which would be needless overhead.

-- 
Kevin P. Fleming
Director of Software Technologies
Digium, Inc. - "The Genuine Asterisk Experience" (TM)



More information about the asterisk-dev mailing list