From ecb1653eee3aa1ce792d5061f1ebfc9f09db6b11 Mon Sep 17 00:00:00 2001 From: Peter Sadrozinski Date: Sun, 8 Sep 2013 14:04:17 -0400 Subject: [PATCH] fix memory leak in tgconstruct --- src/BuildTiles/Main/tgconstruct.cxx | 4 ---- src/BuildTiles/Main/tgconstruct.hxx | 2 +- src/BuildTiles/Main/tgconstruct_poly.cxx | 4 +--- src/BuildTiles/Main/tglandclass.hxx | 10 ++++++++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/BuildTiles/Main/tgconstruct.cxx b/src/BuildTiles/Main/tgconstruct.cxx index 24f84900..7b39ef78 100644 --- a/src/BuildTiles/Main/tgconstruct.cxx +++ b/src/BuildTiles/Main/tgconstruct.cxx @@ -49,10 +49,6 @@ TGConstruct::TGConstruct( const TGAreaDefinitions& areas, unsigned int s, SGLock // Destructor TGConstruct::~TGConstruct() { - // land class polygons - polys_in.clear(); - polys_clipped.clear(); - // All Nodes nodes.clear(); } diff --git a/src/BuildTiles/Main/tgconstruct.hxx b/src/BuildTiles/Main/tgconstruct.hxx index 1d56f13b..83d2c9b4 100644 --- a/src/BuildTiles/Main/tgconstruct.hxx +++ b/src/BuildTiles/Main/tgconstruct.hxx @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include "tglandclass.hxx" diff --git a/src/BuildTiles/Main/tgconstruct_poly.cxx b/src/BuildTiles/Main/tgconstruct_poly.cxx index bca12f5e..e1ba81fa 100644 --- a/src/BuildTiles/Main/tgconstruct_poly.cxx +++ b/src/BuildTiles/Main/tgconstruct_poly.cxx @@ -45,8 +45,7 @@ int TGConstruct::LoadLandclassPolys( void ) { string base = bucket.gen_base_path(); string poly_path; int total_polys_read = 0; - - polys_in.clear(); + tgPolygon poly; // load 2D polygons from all directories provided for ( i = 0; i < (int)load_dirs.size(); ++i ) { @@ -82,7 +81,6 @@ int TGConstruct::LoadLandclassPolys( void ) { SG_LOG( SG_GENERAL, SG_DEBUG, " Load " << count << " polys from " << p.realpath() ); for ( unsigned int i=0; i polys.capacity() ) { - SG_LOG( SG_CLIPPER, SG_ALERT, " area out of bounds " << area << " of " << polys.capacity() ); + SG_LOG( SG_GENERAL, SG_ALERT, " area out of bounds " << area << " of " << polys.capacity() ); exit(0); } polys[area].push_back( p ); } + + // TODO : Let's get rid of this - it was a memory leak, and the polygons should really be modified in place + // NOTE - this will be considerable work, so leaving as is for now (but fix the leak) inline void set_poly( unsigned int area, unsigned int poly, const tgPolygon& p ) { polys[area][poly] = p;