What happens to RhinoObjects not add to the doc?

If I create a bunch of RhinoObjects (like line, points, surfaces,etc ) but never add them to the doc, what happens to them when the script is finished? At the end of the command is everything garbage collected automatically or do I need to cleanup after myself?

I am working on a C# plugin for Rhino if that helps.


It depends… Lines and points are structs and are therefore placed on the stack. Classes like Surface are IDisposable with a finalizer which means you can either dispose of them yourself or wait for the garbage collector to eventually clean these up.