Select to view content in your preferred language

Memory leak in get_Geometry? [C++]

387
0
08-01-2013 01:34 AM
DuncanMallace
Deactivated User
Hey all,

I'm having some troubles in SDK 10.1 with the following code snippet:

IGeometryCollectionPtr geom_coll (line);  // line is an IPolyline
long count;
if (FAILED(geom_coll->get_GeometryCount(&count)))
    return false;

for (int i (0); i < count; ++i)
{
    IGeometryPtr geom;
    if (FAILED(geom_coll->get_Geometry(i, &geom)))    // <-----
    {


The call to get_Geometry keeps some memory allocated that I can't seem to reclaim, and it quickly adds up for large data sets. DevPartner's BoundsChecker marks it as a memory leak, four calls deep into Geometry.dll. The problem can be reproduced even if the for-loop is otherwise empty.

Any idea what I'm doing wrong here? Or perhaps there is another way to get the line's geometry?

Thanks in advance!
0 Kudos
0 Replies