Using Rhinocommon I’m having memory problems with the undo stack using custom objects. When adding a CustomMeshObject to the Document with some other class instances inside (meshes, parameters, whatever you need inside the custom object) the ram usage is being affected but it doesn’t affect to the limit for the undo stack. I mean, the undo stack is not doing the purge when the memory usage is higher than the limit.
To test this I created a CustomMeshObject with a mesh Sphere(Size = 10x10) that has inside
another sphere mesh (Size = 1000x1000) that uses a lot of memory. If you drag the object about 10 times, the document purge event is not being called despite the memory usage goes above 1000MB(according to windows) and 1200MB(according to Rhino). My memory limit at options is 256MB. Seems that Rhino does not take into consideration to the undo stack this elements inside the custom objects. I tried to use the UserData and UserDictionary inside the Geometry of the custom objects but the result is almost the same.
Do you know a workaround for this? I attach the test project with a command “UndoPurgeDataCommand” which adds a sphere and you can check the memory usage dragging it (how it is being increased) and the purge for the undo stack is not being called. Also you have an UserData class in case you want to test with it too.
It’s happening under Rhino 5 and the Rhino WIP latest version.
UndoPurge.zip (54.4 KB)