[Gdal-dev] Forgetting to Destroy?

Curt Mills hacker at tc.fluke.com
Thu Dec 11 14:24:04 EST 2003


On Thu, 11 Dec 2003, Curt Mills wrote:

> Yet another datapoint:  My first SDTS test file only contained
> Points/Polylines, which did not trigger the memory loss.  SDTS files
> which contain Polygons _do_ trigger it.  Shapefile Multipolygons
> also definitely trigger it.
>
> I'm losing memory with these map formats so far:
>
>     SDTS Polygons
>     Shapefile Polygons
>     Shapefile MultiPolygons
>
> Everything appears ok with only Points/Polylines from the few
> formats I've tried.
>
> This is with my "feature" loop essentially disabled:  Get each new
> feature, and then destroy it.
>
> If I disable even that part of the loop and leave only the layer
> loop, memory usage becomes stable.  If I use files containing only
> Points/Lines, memory usage becomes stable.

There appear to be 13 "new" calls in shape2ogr.cpp, while exactly 3
"delete" calls to free the allocated memory.  Those are likely to be
the causes of at least some of the memory leaks I'm seeing, although
I didn't delve into the structure of the code too much.

Similar leaks exist in the SDTS polygon code and perhaps other
drivers.

I'll file it in Bugzilla.

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