Hi John,

I tried this with 1.1.6 and the memory leak is still present.

Looking at the code I still see that the enlarge method is still calling
the swap method which ends up replacing the reference count of the
temporary storage object with the existing one which results in the
buffer not getting freed up.

Zeid


-----Original Message-----
From: K. John Wu [mailto:[email protected]] 
Sent: Wednesday, February 10, 2010 10:41 PM
To: FastBit Users
Cc: Derhally, Zeid
Subject: Re: [FastBit-users] Memory leak in
fileManager::storage::enlarge ?

Hi, Zeid,

Thanks for the report.  This particular issue should have been fixed 
in ibis1.1.6.  If you get a chance, please give it a try.

There is a note about the change from Jan 29 in ChangeLog, which reads

* src/fileManager.cpp: storage::enlarge used copy-and-swap idiom
incorrectly and caused the client to assume the operation was a
failure

Please feel free to let us know if you continue to see problems with 
this function.

John


On 2/10/2010 2:47 PM, Derhally, Zeid wrote:
> Hi,
>
> I believe I've run into a memory leak with ibis 1.1.5
>
> In the function, ibis::fileManager::storage::enlarge, there is a call
to
> swap() around line 1909, looks like
>
> try {
>
> ibis::fileManager::storage cp(nelm);
>
> memcpy(cp.m_begin, m_begin, oldsize);
>
> cp.m_end;
>
> swap(cp);
>
> }
>
> catch (...) {
>
> LOGGER(ibis::gVerbose >= 0)
>
> << "Warning -- " << evt << " failed to allocate new storage, "
>
> "current storage unchanged";
>
> }
>
> The swap function also swaps the reference count value which causes
the
> m_begin buffer to not be freed up because the temporary object on the
> stack inherited the reference count of the current object.
>
> I've made a change in my sources where I did not swap the reference
> count when enlarging the storage and that took care of the leak.
>
> Thanks.
>
> Zeid
>
>
>
> _______________________________________________
> FastBit-users mailing list
> [email protected]
> https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users
_______________________________________________
FastBit-users mailing list
[email protected]
https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users

Reply via email to