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
Size:
Color:
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.
Size:
Color:
i.e., You should always make sure to call the StreamWriter Close() method after finishing writing to a file stream.
Size:
Color:
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
Size:
Color:
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.
Size:
Color:
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" ?
Size:
Color:
It's slowpoke so why not try help it start working by imitating some continuous activity?
Size:
Color: