The Hugin C#/.NET Core/.NET 5/.NET 6 API is comprised of two parts: a managed part written in C#, and an unmanaged part written in C. Contrary to managed objects, unmanaged data objects are not automatically reclaimed (or garbage collected) when a program stops referring to them. Therefore, some explicit memory management is needed in order to avoid memory leaks.
For example, when a managed Domain object is no longer needed, it should be deleted. Deleting a Domain object will cause all the unmanaged objects associated with the Domain object to be implicitly deleted: the unmanaged domain object, the unmanaged node objects, etc. At the same time all managed objects corresponding to those unmanaged objects are marked "dead" (that is, invoking methods on such objects will cause ExceptionObjectNotAlive exceptions). When the managed program stops referring to dead objects, the garbage collector can reclaim them.
Only objects that are not "owned by" other objects require explicit deletion. (For example, nodes are owned by a Domain or a Class object, a Class object is owned by a ClassCollection object, etc.) An object owned by another object is automatically deleted when its owner is deleted.
The following objects are not owned by other objects and must therefore be explicitly deleted in the managed code: