Simulate Early, Simulate Often... In Rhino
The scripting engine for Rhino works great. I am running an optimization using Rhino 4 on Windows 7 (64 Bit). The goal function is a computation done with calculations from the SnS Scripting.
The problem is: I don't know how to release the memory used by the plugin. Thus, after a
number of computations Rhino runs out of memory. I have attached the script file (e1.rvb)
which illustrates the problem.
So far the only workaround I have found, is to call the new command after a number of
computations. This frees a significant amount of memory.
Perhaps there is another method to release the memory? It seems that the memory used by invoking SnS-script methods for graphic objects is not released at the destruction of the object. Perhaps you have an idea what to do? Or is it a general problem of rhinoscript ?
Best regards and thank you in advance
Notwithstanding potential memory leaks in SnSScript, one thing that will help is to add the following in the loop in your script:
This will clear the undo buffer and avoid accumulating geometry on the undo stack. SnSScript also duplicates the geometry before attaching or removing Scan&Solve data, so calling _ClearUndo will minimize the growth in memory consumption due to running SnSScript commands.
I'll also take a look through the code for potential memory leaks.
Thanks ! It seems to work.
I've just uploaded the latest WIP of the SnSScript plug-in (Version 2012.7.8.0). One of the notable changes is that it no longer copies the geometry to the undo stack when changes are made to the Scan&Solve data.
Try it out and let us know how it works.
the plug-in works fine for me. The memory load is now ok. Also, the probability to interrupt the script with the keyboard has increased.
Another question: Can the function QuerySolutionValue(GUID, Component, QueryPoint) return a value of -1.7e+308 ? I was requesting the von Mises stress at a surface point. The point is actually on the surface and the SnS-GUI shows value in a range of 1000 MPa.
Thank you in advance
A value of -1.7e+308 is a generic invalid value indicating something is wrong in the querying process. If you turn on output with SetOutputOnOff, SnSScript will report to the command line information on the offending internal operation.
Does this help?