This may likely be an issue with my inexperience using a Managed Language. The issue essentially is a loop within an objects method, which executes over about 20 seconds, throughout the duration of this loop the programs overall memory usage constantly goes up. Now all the variables within the loop which are modified are variables defined within the loops scope (ie. no class members are changed/re-allocated within the loop). After the entire method completes the excess memory is still being used.
I have absolutely no idea why/where this issue is but here are some things which may be a factor:
- I use fonts within the loop, but I '.Dispose()' of them and have verified that there is no GDI leak.
- I have try/catch statements which are in active use.
- Objects are allocated...
So again, any ideas on where this issue may be coming from would be very helpful, I would post code but there is a lot of it. Also as mentioned above the memory is not cleaned up after the method call is done, and even after the object on which the method was invoked has gone out of scope.
Edit
I also just tried the GC.Collect() method, and nothing has changed in the overall result. I have no idea, but does this mean that the memory is not considered 'Garbage'? Again all the allocation is done within the scope of the loop so shouldn't it be considered garbage after the loop terminates. I understand the GC won't immediately get to cleaning it up, but using the GC.Collect() call should force that?