ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What's the difference between "pEnt->close" and “delete pEnt"?

2 REPLIES 2
Reply
Message 1 of 3
chunyuran
389 Views, 2 Replies

What's the difference between "pEnt->close" and “delete pEnt"?

 I new a AcDbEntity. If I don't add it to database, which one should be used before function returns?

 

Thanks in advance.

2 REPLIES 2
Message 2 of 3
owenwengerd
in reply to: chunyuran

After you successfully add an entity to a database, the database takes over ownership. While the database owns an object you must not destroy it, and use open/close to access it.

--
Owen Wengerd
ManuSoft
Message 3 of 3
artc2
in reply to: owenwengerd

And, if you don't add the new entity to a database and you also don't retain a pointer to the entity after your function returns, then you've leaked the memory that the entity is using because you have no way to delete that entity.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost