Hi, I used “Rhino.geometry.intersect.intersection.MeshLine” method in C#-script component on gh for checking Ray intersection and it ran more than thousand times.
The problem was that the memory usage of the computer kept increasing during repeating calculation.
It seems the C#-script component won’t release his memory.
Does anyone know why this happen?
Thank you,
Akito
I’ve managed to pin-point a simple scenario to replicate the problem.
private void RunScript(Mesh m, object x, ref object A)
{
// Creating a List o points
List<Point3d> points = new List<Point3d>();
for(int i = 0;i < 100;i++){
for(int j = 0;j < 100;j++){
points.Add(new Point3d(i, j, 0));
}
}
for(int j = 0;j < 100;j++){ // Looping to inflate the bug, but not needed
for(int i = 0;i < points.Count;i++){
Line line = new Line(points[i], points[i] + Vector3d.ZAxis);
int[] faceIds;
Point3d[] intersections = Rhino.Geometry.Intersect.Intersection.MeshLine(m, line, out faceIds);
}
}
}
… with a specific mesh (internalized), dragging the slider I can see Rhino memory usage going up by 200MB at time and never going back. I can continue until filling the whole memory of my machine and everything freezing up… MeshLine memory bug.gh (21.1 KB)
I can replicate this bug on the 2 machine I’ve tried this ^