[Gdal-dev] Forgetting to Destroy?

Curt Mills, WE7U hacker at tc.fluke.com
Thu Dec 11 12:12:50 EST 2003


My code is currently reading Shapefile maps via OGR.  If I disable
the feature loop, memory appears relatively stable.

Enabling the feature loop, I'm losing megabytes every time I read
in Shapefiles.  I disabled the majority of the "feature" loop via
#ifdef's, and am just running this now:


  while ( (featureH = OGR_L_GetNextFeature( layer )) != NULL ) {
      if (featureH)
          OGR_F_Destroy( featureH );
  }


It's still losing megabytes every time I load a map.  Using CVS
GDAL/OGR and of course the 'C' API.

Is OGR_F_Destroy() not free'ing all the memory used?

I register all drivers when I start my app (a long-running app by
the way), and leave them alone after that.  Is there something that
I should Destory/Free regarding the drivers?

I'm not free'ing the layers either, but it appears from your 'C'
sample program that I should not.  There doesn't appear to be a big
problem in the layers anyway.

-- 
Curt Mills, WE7U                    hacker_NO_SPAM_ at tc.fluke.com
Senior Methods Engineer/SysAdmin
"Lotto:    A tax on people who are bad at math!"
"Windows:  Microsoft's tax on computer illiterates!" -- WE7U
"The world DOES revolve around me:  I picked the coordinate system!"



More information about the Gdal-dev mailing list