memory management

Ken Murchison ken at oceana.com
Mon Oct 10 13:39:01 EDT 2005


Arvind Sachdeva wrote:

> ahh!! so I will have to store all my pointers till mech_dispose is 
> called, a list of pointers in conn_context,  isnt that bad ?

You don't have to do it this way, but its what all of the current 
plugins do.


> 
> On 10/10/05, *Ken Murchison* <ken at oceana.com <mailto:ken at oceana.com>> 
> wrote:
> 
>     Arvind Sachdeva wrote:
> 
>      > Hi,
>      >
>      > I am writing client/server plugin for cyrus library. I allocated
>     memory
>      > for serverout string in mech_step function on server side. Where
>     is this
>      > string supposed to be freed ? According to the general convention
>     if my
>      > plugin allocates the memory it should be freeing it. But I dont
>      > understand in which function should I free the memory.
>      > Should I cache the pointer and free it on subsequent mech_step
>     call, or
>      > should I do something like cache all pointers and free them at
>     the end.
>      >
>      > Or am I missing a simple function that will be called back from the
>      > application just for this purpose ?
> 
>     You'd probably free() the memory in mech_dispose() or mech_free().  You
>     could probably use the PLAIN plugin as a template.
> 
>     --
>     Kenneth Murchison     Oceana Matrix Ltd.
>     Software Engineer     21 Princeton Place
>     716-662-8973 x26      Orchard Park, NY 14127
>     --PGP Public Key--    http://www.oceana.com/~ken/ksm.pgp
>     <http://www.oceana.com/~ken/ksm.pgp>
> 
> 


-- 
Kenneth Murchison     Oceana Matrix Ltd.
Software Engineer     21 Princeton Place
716-662-8973 x26      Orchard Park, NY 14127
--PGP Public Key--    http://www.oceana.com/~ken/ksm.pgp


More information about the Cyrus-sasl mailing list