.NET Development: Run out of memory When frequently Using Route.GetDirections()
1 to 4 of 4
-
- CommentAuthorPeterW
- CommentTimeNov 10th 2010
I tried to pre-calculate a set of routes (the route Matrix for a set of locations),
I need to get the directions in each of the route to find something.
So, I tried two ways to solve the problem:
1. Each time a new Route object is created by using "Route route = new Route();"
and then Using Route.GetDirections().
2. Create Route object only once, each time only modify the Start and End of the object,
Then recalculate and GetDirections.
In both cases, it eventually runs out of memory.
It is faster in memory consuming in case 1 because new Route object is created each time.
There is no way to dispose the memory manually for the Route object.
I tested two cases in a very simple and isolated code environment, the problem is persistent.
How can we solve the problem? -
- CommentAuthorPeterW
- CommentTimeNov 11th 2010
I did more testing, it seems related to the COM and threading.
If the Route object is created in a working thread, and do SendMessage pumping
with "System.Windows.Forms.Application.DoEvents()", then the most memory is cleared up at
the end. I still observed very slow accumulation of the holding memory. -
- CommentAuthorSharonD
- CommentTimeNov 14th 2010
Hi Peter,
I have created a support case for you, we will be dealing with your issue through that case.
Kind regards,
Sharon
1 to 4 of 4
