|
Geometry : |
Subject: [geometry] Populating and destructing multi geometries
From: Alessandro Ranellucci (alex_at_[hidden])
Date: 2013-05-18 15:48:30
Hello,
I'm the maintainer of the Perl bindings (Boost::Geometry::Utils)
and I'm tracking down a memory leak that I introduced in the
code that transforms Perl data structures to multi_linestring geometries.
First off, I couldn't find any examples about how to populate
multi geometries. This is what I'm doing now:
==
multi_linestring* mls = new multi_linestring();
for (...) { // loop through lines in Perl data structure
linestring* ls = new linestring();
for (...) { // loop through points in Perl data structure
ls->push_back(av_fetch_point_xy(innerav));
}
mls->push_back(*ls);
}
==
Does this look correct?
Now, how am I supposed to delete the multi_linestring object
with all of its linestrings? 'delete mls' doesn't seem to free everything.
Am I supposed to walk it myself and delete the individual linestrings?
Thank you very much in advance,
- Alessandro
Geometry list run by mateusz at loskot.net