Re: [Cflowd] [Fwd: Fix for memory leak on each config re-read.]

From: Shvedko Pavel (shved@mtu.ru)
Date: Thu Mar 21 2002 - 05:52:03 PST


"Nicholas L. Nigay" wrote:

> Hello, Pavel !
>
> Seems You were right about my previous way to solve memory leak problem.
> The following decision is aware about several pointers
> 'looking' at the same place since it uses CflowdCiscoMap::Clear()
> and CflowdCollectorMap::Clear() which are correct.
>
> I think that CflowdCollectorMap::Clear() is correct since it
> calls delete() only once per 'COLLECTOR stanza' when
> ((*collmIter).first == (*(*collmIter).second).IpAddress()).

It is incorrect to satisfy a condition after deleting CflowdCollector object if
CflowdCollectorMap contains aliases

>
>
> The same idea is in CflowdCiscoMap::Clear().
>
> void CflowdConfig::Clear()
> {
> if (this->_ciscoMap.size() > 0) {
> this->_ciscoMap.Clear();
> }
>
> if (this->_portList.size() > 0)
> this->_portList.erase(this->_portList.begin(),this->_portList.end());
>
> if (this->_collectorMap.size() > 0) {
> this->_collectorMap.Clear();
> }
> return;
> }
>
> PS: I suppose we talking about cflowd-2-1-b1

of course...

>
> PPS: Hope this time no bugs. 8-)
>



This archive was generated by hypermail 2.1.4 : Mon Mar 25 2002 - 11:16:01 PST