p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   Pro Visual Basic 2005 (http://p2p.wrox.com/pro-visual-basic-2005-217/)
-   -   "OutOFMemoryException" (http://p2p.wrox.com/pro-visual-basic-2005/67774-outofmemoryexception.html)

Juan Patrick April 29th, 2008 10:39 PM

"OutOFMemoryException"
 
I am working in Visual Studio 2005, and am running a model that is meant to run through 500000 clients, and project things for them 25 years in the future.

In each years loop, different dll functions are called and values obtained.

The model runs though around 300000 clients successfully before crashing with the "OutOfMemoryException" message. Under numerous runs, it has been seen that no particular borrower, or no particular dll function is the source of the problem, but it always crashes on a dll function.


I have tried to clear memory by using GC.Collect(), but it has made no difference.

Is there anything I can be looking at to clear memory, help the programme run though?

Cheers

Gus

JP.

BrianWren April 30th, 2008 11:51 AM

I'm not surprised that GC.Collect() has no effect. The GC runs automatically when space is needed. If collection could fix the problem it would be automatically done for you through that methodology.

It certainly appears to me that you have a memory leak. I have not addressed anything like this, but in thinking about what I would do if this happened to me (in addition to posting a question on WROX P2P, which I certainly would do—as you have), is add a reporting mechanism (to be removed once the problem is solved), and use APIs or the functionality of .NET to report memory stats when you anticipate consuming memory, and where you anticipating reclaiming memory, to see if you can detect an imbalance.

Perhaps—without actually determining the culprit—loading the DLL just once, and adding a re-initialization method to be used prior to each loop will make you “leak” the memory just once, which apparently is not a problem (since the error isn’t fatal until after 300,000 iterations).


All times are GMT -4. The time now is 05:48 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.