Boost logo

Geometry :

Subject: [geometry] Memory leak in rtree
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2012-11-21 08:40:01


Hi all,

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 :)

Cheers,
Christophe


Geometry list run by mateusz at loskot.net