Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Memory leak in get_Geometry? [C++]

$
0
0
Hey all,

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

Code:

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!

Viewing all articles
Browse latest Browse all 1374

Trending Articles