Profile Picture

Avoid high memory use by controlling the .NET Garbage Collector

Posted By stephan 11 Years Ago

Avoid high memory use by controlling the .NET Garbage Collector

Message
Posted Sunday December 24 2006
Avoid high memory use by controlling the .NET Garbage Collector

At some optimization tests I was running in out of memory exceptions.

By adding a garbage collection cleanup in the overriden Startup method, I solved the problem.

Here is what I have done:

// Code that can run into out of memory exception during optimization
public override void Startup()
{
// Perform initialization or set system wide options here
      this.SystemData.ProfitTarget = SystemParameters["ProfitTarget"]; // 5%
      this.SystemData.BarCountExit = Convert.ToInt32(SystemParameters["BarCountExit"]);
   }

// Now the same code with cleaning up the dead objects after a run (GC.Collect())
public override void Startup()
{
// Perform initialization or set system wide options here
      this.SystemData.ProfitTarget = SystemParameters["ProfitTarget"]; // 5%
      this.SystemData.BarCountExit = Convert.ToInt32(SystemParameters["BarCountExit"]);
      GC.Collect();
   }

I am using the Beta 3. It would be nice, if the optimization loop would do this itself inside the test loop.

The optimization system form is also loosing the values at the next load. It would also be nice, if the last entered values would be a bit more persistent.

Greetings

Stephan
Posted Sunday December 24 2006
This is probably the best work around currently available.  Thanks for sharing this.  We're working hard over here to optimize the way memory is used.  I think this is going to be the best solution when it's completed.
Posted Tuesday January 20 2009
i haven't installed the latest beta because of the known bugs that needs to be fixed first.

So i'm using the latest official stable version, build 380
Unfortunately i can't see any memory improvement here. Does it improve it only in the latest beta versions?
Posted Tuesday January 20 2009
Yes.  This was a serious architectural shift.

Tradix (1/20/2009)
i haven't installed the latest beta because of the known bugs that needs to be fixed first.

So i'm using the latest official stable version, build 380
Unfortunately i can't see any memory improvement here. Does it improve it only in the latest beta versions?
Posted Tuesday January 20 2009
Build 380 does do a GC.Collect after every optimization run.  Even in RE2008E2, you will need to do some things in your system if you need to lower the memory usage.  See the "Large data set support" section of the RightEdge 2008 Edition 2 Guide for more info.

Thanks,
Daniel



Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems