Boost logo

Geometry :

Subject: Re: [geometry] Memory leak in rtree
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2012-11-21 11:11:13


Christophe Henry wrote:
> valgrind reports a memory leek in the (extension) rtree. The memory
> leak manifests itself when one creates an rtree and deletes it without
> doing anything else.
> I suspect the error is:
>
> inline ~rtree()
> {
> if ( !this->empty() ) // <- if we create and are empty, this fails
> this->destroy(*this);
> }
>
> If one only creates the tree then deletes it, m_values_count is 0, but
> we still allocated memory for the root node => leak.
>
> After removing the if statement, valgrind is happy :)

Hi,

Thanks for the info. This was already fixed in dev branch so I've merged
the code. Please check it out. There is a lot of changes related to
exception-safety. As usual:

http://svn.boost.org/svn/boost/sandbox-branches/geometry/index/

Unfortunately the interface was slightly changed. Methods and functions
names:
- query() was changed to spatial_query(),
- nearest() to nearest_query(),
- corresponding filters names was also changed, now they're in
'adaptors' namespace.
Please see the docs.

If you have any suggestions, let me know.

Regards,
Adam


Geometry list run by mateusz at loskot.net