tags:

views:

98

answers:

3

Im running into a problem where the tool im using for development (a simulator tool) keeps throwing OutofMemoryException's, I know its not my app, because no matter what project im running, it happens.

The only fix I have for it so far is to restart my PC, is there a way to flush/clear the CLR runtime so I dont have to restart my PC each time it happens?

A: 

OutOfMemoryExceptions don't necessarily indicate a problem with the runtime. Any time your system runs out of memory, regardless of what's consuming it, this can happen.

Look at the process list in the task manager and see what's consuming the most memory.

Andy West
I see, well, looking at my task manager, Im only using 1.68GB of memory and the PC has 4GB available to it. So I dont think that its the physical resources thats the problem
Mark
Ok. It could be that the GC heap is fragmented. You could try using the DumpHeap command in the SOS Debugging Extension (http://msdn.microsoft.com/en-us/library/bb190764%28VS.80%29.aspx). If you see a large percentage of "Free" slots, you've got fragmentation.
Andy West
And what if i do?
Mark
Andy West
You dont have to appologise, thanks for the help
Mark
+1  A: 

Each process that runs managed code starts up a separate copy of the CLR runtime - and when any kind of process is terminated, the memory it consumed is reclaimed into the general pool.

There is nothing shared to "flush" or "clear".

Is it possible that your simulator tool isn't crashing "all the way" - that the process is sticking around in a faulted state?

Bevan
Possibly, but I cannot see any processes that look suspicious at the moment. I really have no idea :(
Mark
+1  A: 

It sounds like this is a 3rd party tool. So I'd be filing a bug request with them.

But as others have said, the issue will be contained within an operating system process. Using task manager, you should be able to identify the offending process and kill it. That will reclaim the memory and wipe the slate clean. You'll then have to restart your simulation.

If this problem is preventing you from completing your simulation, then I'd file an urgent (but not angry) bug request.

Thats just the thing, I dont see any tasks that are taking up that much memory. But dont worry I will be raising a bug fix! :)
Mark
OoME can be caused by things other than using lots of memory. I once got an OoME because I forgot to dispose of Bitmap objects, I exhausted the supply of GDI handles.