EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: ca_create_channel memory management
From: [email protected]
To: "Tim Mooney" <[email protected]>
Cc: [email protected], [email protected]
Date: Mon, 31 Jan 2011 08:58:14 -0800 (PST)
Is it possible to do this? Would you need a global variable referencing
each cleared channel?

> If your channel is doing any callbacks (e.g., you're monitoring it),
> you might have outstanding monitors at the time you decide to clear
> the channel.  You need to tell your callback routine to ignore any
> calls that come after you've called cleanup(), so it doesn't reference
> pUserPrivate after it's been freed.
> Tim
>
> ----- Original Message -----
>> From: [email protected]
>> To: "Andrew Johnson" <[email protected]>
>> Cc: [email protected]
>> Sent: Friday, January 28, 2011 11:56:37 AM
>> Subject: Re: ca_create_channel memory management
>> So:
>>
>> void cleanup(chid ChanID) {
>> void* pUserPrivate;
>>
>> pUserPrivate = ca_puser(ChanID);
>> free(pUserPrivate);
>> ca_clear_channel(ChanID);
>> }
>> ?
>>
>> > Hi Patrick,
>> >
>> > On Friday 28 January 2011 11:10:29 [email protected]
>> > wrote:
>> >> If you allocate memory and send a pointer to it in the puser field
>> >> of
>> >> ca_create_channel, does it get freed when ca_clear_channel is
>> >> called, or
>> >> should I do that explicitly?
>> >
>> > There's no way the CA API could know whether it should do that or
>> > not, so
>> > it
>> > doesn't and it falls on you to do it yourself.
>> >
>> > - Andrew
>> > --
>> > If a man is offered a fact which goes against his instincts, he will
>> > scrutinize it closely, and unless the evidence is overwhelming, he
>> > will
>> > refuse to believe it. If, on the other hand, he is offered something
>> > which affords a reason for acting in accordance to his instincts, he
>> > will accept it even on the slightest evidence. -- Bertrand Russell
>> >
>> >
>
> --
> Tim Mooney ([email protected]) (630)252-5417
> Software Services Group (www.aps.anl.gov)
> Advanced Photon Source, Argonne National Lab
>
>


Replies:
Re: ca_create_channel memory management Tim Mooney
References:
Re: ca_create_channel memory management Tim Mooney

Navigate by Date:
Prev: Re: epicsEvent (posix implementation) bug ? Andrew Johnson
Next: RE: epicsEvent (posix implementation) bug ? Jeff Hill
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: ca_create_channel memory management pthomas
Next: Re: ca_create_channel memory management Tim Mooney
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·