Memory consumption issue
Author: Musashi1970
Creation Date: 2/24/2011 5:02 AM
profile picture

Musashi1970

#1
Hi

I execute a calculation-intensive strategy to a large data set (~ 1000 symbols). The analysis results will be written in a csv-file. Also it takes a while, it works perfectly alright, but after the strategy has been executed and the file has been written, my PC is working turtle-slowly. A look into the task manager shows that WealthLab still uses about 5 GB of RAM, although it does nothing really. So far, the only way to get my PC back to working normal is to force a shut down of WLD.

Do you have an idea how I can let WLD free up the memory again after finishing the strategy ?

Many Thanks

Kind Regards
profile picture

Eugene

#2
This was pointed out many times: Garbage Collector in .NET 2.0 is slow at releasing memory. It has been improved in .NET 4.0 but it might take a lot of time when WL6 is ported to .NET 4.0.

1. If you're sure that the code is written in a proper manner, then:
a. Close your Strategy and other WL tools,
b. Try repeatedly executing a simple strategy like "Moving Average Crossover" (that ships with WL6) on a small DataSet (using Daily data e.g. "Dow 30", 500 bars loaded) - a few times. If that doesn't help kickstart the GC, then proceed to step 2.

2. Review your Strategy. The code could be designed in a manner preventing from releasing the resources properly after using a StreamWriter (or something else) but without looking at the actual code it's just guesswork.

profile picture

Cone

#3
i.e., You should always make sure to call the StreamWriter Close() method after finishing writing to a file stream.
profile picture

Musashi1970

#4
Thanks for the quick reply

QUOTE:
without looking at the actual code it's just guesswork.

QUOTE:
You should always make sure to call the StreamWriter Close() method after finishing writing to a file stream


That is part of the relevant code:

CODE:
Please log in to see this code.


Therefore, I think the streamwriter is handled correctly.

QUOTE:
If that doesn't help kickstart the GC,

Do you mean the Dispose-Method ? (Would the call then be (name of the strategy-class).Dispose() ?

Thanks again
profile picture

Eugene

#5
QUOTE:
foreach(string symbol in DataSetSymbols)

You don't run this code as a Multi-Symbol Backtest, don't you?
QUOTE:
Do you mean the Dispose-Method ? (Would the call then be (name of the strategy-class).Dispose() ?

I think that Wealth-Lab is designed to call .Dispose after closing a Strategy window. What I've suggested above is slightly different.
profile picture

Musashi1970

#6
QUOTE:
You don't run this code as a Multi-Symbol Backtest, don't you?


No, I just run the strategy on a single symbol (similiar to a rotation strategy)

What do you mean by "kickstart the GC" ?
profile picture

Eugene

#7
It's slowpoke so why not try help it start working by imitating some continuous activity?
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).