Changes between Initial Version and Version 2 of Ticket #738


Ignore:
Timestamp:
Apr 2, 2007, 9:19:43 PM (17 years ago)
Author:
warmerdam
Comment:

Matuesz,

Could you review this, and see if you can reproduce a reference counting bug? As you can imagine, I'm still not keen on the boost auto_ptr solution. :-)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #738

    • Property Severity criticalnormal
    • Property Cc warmerdam added
    • Property Priority highnormal
    • Property Milestone1.4.2
    • Property Owner changed from warmerdam to Mateusz Łoskot
  • Ticket #738 – Description

    initial v2  
    1 {{{
    2 OGR uses reference counting for some object to manage the life cycle of objects as well as to
    3 decrease OGR memory requirements.
    4 In particular SpatialReferenceSystems are reference counted. While reference counting is
    5 consistent in OGRProj4CT, namely
    6 OGRSpatialReference are deleted when counter falls below 1, in OGRGeometry eg.
    7 OGRGeometry::~OGRGeometry and
    8 OGRGeometry::assignSpatialReference a counter is released without checking if
    9 OGRSpatialReference should be deleted. This may
     1OGR uses reference counting for some object to manage the life cycle of objects as well as to decrease OGR memory requirements.
     2In particular SpatialReferenceSystems are reference counted. While reference counting is consistent in OGRProj4CT, namely
     3OGRSpatialReference are deleted when counter falls below 1, in OGRGeometry eg. OGRGeometry::~OGRGeometry and OGRGeometry::assignSpatialReference a counter is released without checking if OGRSpatialReference should be deleted. This may
    104result in memory leak.
    115
    126   SAMPLE FIX/WORKAROUND:
     7
    138The quick fix is to check if reference counter falls below 1 and eventually delete the object eg.
    149
     10{{{
    1511OGRGeometry::~OGRGeometry()
    1612{
     
    2117   }
    2218}
     19}}}
    2320
    2421However, a better way to manage reference counted objects is to use consistently in GDAL
     
    3027recommend such
    3128technique, as this is simple way to avoid related with reference counted memory management.
    32 }}}