I am using Boost::Polygon - Polygon 90 Set Concept to store a huge amount of rectangels. Unfortunately I cannot de allocate the memory after I am done.
Here is a minimal example. I'd like to de allocate the memory of the polygon set at a certain point. The clear() command does not de allocate (as mentioned in the docu).
Anyone an idea how to de allocate without running out of scope?
#include <iostream>
#include <boost/polygon/polygon.hpp>
// Namespaces
using namespace std;
namespace bp = boost::polygon;
// Typedefs
typedef bp::rectangle_data<int> bpRect;
typedef bp::polygon_90_set_data<int> bpPolygonSet;
int main()
{
bpPolygonSet ps;
cout << "Filling" << endl;
for (int i=0; i<10000000; i++){
bpRect rect(i, i, i+1, i+1);
ps.insert(rect);
}
// clear() does not de allocate
ps.clear();
cout << "Cleared" << endl;
std::cin.get();
return 0;
}