Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Preventing memory leaks in AcDbEntity::worldDraw()

0 views
Skip to first unread message

Jon Rizzo

unread,
Jun 30, 1999, 3:00:00 AM6/30/99
to
I have created an object that creates offsets of itsself in it's
worldDraw() function. These offsets are memory resident (they are
regenerated in world draw but are not added to the database) I got
the idea from the AdeskLogo object in ArxDbg.

My problem is this: I am creating the offsets in a loop, so I need to
delete the pointers to these memory resident objects before I leave
loop, but doing so causes AutoCAD to crash. If I don't delete them,
the function works fine, but I'm creating a lot of memory leaks,
aren't I?

Jon

Art Cooney

unread,
Jun 30, 1999, 3:00:00 AM6/30/99
to
I think we'd need to see your code to try and figure out what's going
wrong. :)

Jon Rizzo

unread,
Jul 1, 1999, 3:00:00 AM7/1/99
to

the basic idea is this:
es = ((AcDbPolyline*)(this))->getOffsetCurves(dist, original);
pPline = (AcDbPolyline*)(original[0]);
dc->rawGeometry()->draw(pPline);

once I get to here, I loop back again, so "original" is not needed.
Since the polyline was only drawn, and is not database resident,
wouldn't it be proper for me to use this?:
delete pPline;

pPline->close(); appears to be working, but is this actually
accomplishing what it implies? I somehow got the impression that you
are supposed to "delete" non database resident entities when you are
done with them.

On Wed, 30 Jun 1999 10:08:40 -0700, Art Cooney <ar...@autodesk.com>
wrote:

Art Cooney

unread,
Jul 7, 1999, 3:00:00 AM7/7/99
to
There's nothing wrong with what you want to do, but without seeing your
actual code, I can't tell if you've done something that could cause a
problem.

If you call close() on a non-dbresident object, close() will do nothing and
will return eNoDatabase. If close() returns eOk, then the object is in a
database.

0 new messages