Wrox Programmer Forums
|
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 29th, 2008, 09:39 PM
Registered User
 
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default "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.
 
Old April 30th, 2008, 10:51 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

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).





Similar Threads
Thread Thread Starter Forum Replies Last Post
System.outOfMemoryException dhol General .NET 2 December 29th, 2004 08:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.