This project has moved. For the latest updates, please go here.

Exception of type 'System.OutOfMemoryException' was thrown.

Mar 25, 2015 at 11:48 AM
Hello Sir,

I run user for several days but then I get this exception
"Exception of type 'System.OutOfMemoryException' was thrown."
Mar 25, 2015 at 5:15 PM

The LINQ to Twitter stream returns a StreamingContent instance. Make sure that you aren't holding a reference to these instances. Also, make sure you aren't holding references to the Entity property instance. This can happen if you create a collection that you add these object to, but never clear that collection or hold a reference to that collection. You can also use a memory profiler to track down which objects are being allocated and not released.

If you don't already have a profiler, the CLR Profiler is free and can help you track down memory leaks:

CLR Profiler

It has documentation included - it might take a while getting used to, but I've used it successfully in situations where another profiler wasn't available.

Look at your OutOfMemoryException stack trace to see if it gives you any clues.