algorithmic modeling for Rhino
Hallo all
I am working on a heuristik in order to place as many objects in an area so that they can be seen from multible points.
Therefor I need to generate as many possible placements as possible.
Unfortunatly my VB script allways runs out of memory (200000+ polylines...)
I define all my used variables at the beginning of the script.
I only use ByRef when passing variables to a function.
And still during computation it builds up memory usage.
Is the garbage collection running while the vb script is computed or only at the end ?
If is there any way to call for garbage collection?
thx
Richard
Tags:
Hi Richard,
the garbage collector is always running. Calling it specifically won't solve any problems. If you're running out of memory, you probably just have too much data stored. There's some ways to try and tackle this:
"I define all my used variables at the beginning of the script."
I don't see how this will affect anything at all.
"I only use ByRef when passing variables to a function."
This, too, probably doesn't matter. If you're passing reference-types then it doesn't get duplicated anyway, and if you're passing value-types then they'll only require memory while that function is running. Unless your functions are deeply recursive this won't make a difference.
I suppose the most important question is, why do you need to keep all those polylines around? If you're trying to find the best solution, why don't you discard sub-optimal solutions as you go?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
THX David for the replay.
"I suppose the most important question is, why do you need to keep all those polylines around? If you're trying to find the best solution, why don't you discard sub-optimal solutions as you go?
"
And here is my problem. I erase polygones from the list as soon as they get irrelevant, but still the memory keeps on building up.
Pseudocode:
PolylineList ... Stores all Polylines
tempPolylineListList ... Stores the part of the List that is worked on
While tempPolylineListList is not empty Do
tempPolylineList = PolylineList.getRange(0,n)
... doSomething with the tempPolylineList
remove all Polylines from PolylineList that are not part of a possible Solution
Loop
tempPolylineList = PolylineList.getRange(0,n) ' does this duplicate the entries or is it only referencing the entries?
Is there any way to monitor the behaviour of the PolylineList / tempPolylineList other then the print() command in the vb script button?
I won't be able to find memory bugs in pseudocode. You'll need to post some code that actually runs and duplicates the problem.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by