Re: OutOfMemory Exception

Cory Foy <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <[email protected]>
[email protected] wrote:
> So the test fixture setup and teardown would contain no AllocHGlobal or
> FreeHGlobal, this seems to fix the InsufficientMemory Exception that we
> were getting but we're no closer to figuring out why.  Maybe a memory
> leak in the text fixture setup?  This seems unlikely though but the
> pattern of failures do indicate a memory problem.  I just can't see how
> it can be our code as of yet.

Hi Robbie,

You may want to try capturing Perfmon statistics to see if you have a 
managed or native memory leak. See this article to help get you started:

http://msdn.microsoft.com/msdnmag/issues/07/01/ManagedLeaks

Also, it may be that you aren't really running out of memory, but your 
memory is so fragmented that it can't get a continuous block of memory 
during allocation. That would lead to an OOM - even if you have plenty 
of free memory. You may want to try an explicit call to GC.Collect to 
see if that helps clean it up. Pinning is one of those things that can 
really screw up the GC.

-- 
Cory Foy
http://www.cornetdesign.com



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.