ivs3d

Memory leak in get_Geometry? [C++]

Discussion created by ivs3d on Aug 1, 2013
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!

Outcomes