On 8/27/2020 2:15 PM, Jason Biggs wrote:

What I'm trying to understand right now is the expected lifetime of an Atom
pointer returned by a molecule, for instance by the getAtomWithIdx method.
Based on the documentation, since this method doesn't say the user is
responsible for deleting the returned pointer I know I'm not supposed to
delete it. But when exactly does it get deleted?  If I dereference it after
deleting the molecule, what is it?

The more general answer is:

a) when the program terminates, all its resources are returned to the OS. It was a common CGI technique to not bother and just let the it run to the end. (It was also one of the "mobile Java" things with cellphone vendors: they wanted garbage collection off.)

b) Unlike "garbage-collected" languages c++ has guaranteed object destruction. If there's any resources you want to explicitly relinquish, the destructor is the place to do it.

If your program is not an "up forever" server, you could just let it be: it'll all get cleaned up on exit.

HTH,
Dima


_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to