Posted By: pascalx
Memory leak in Strategy Test - 09/06/17 11:46
I get Error 060: Memory fragmented / limit exceeded regularly when testing a few strategies. Zorro can have a strategy that, let's say, allocates 800 MB in one test run. Now if you happen to run 3 other strategies afterwards with 800 MB each too, then you already crash Zorro. There is no memory cleanup after a test run, so it just takes a few scripts to exceed the memory limit.
Consider this script and create 4 instances of it. Use the Zorro M1 history data. Run each script once. Zorro will run out of memory.
The expectation is that Zorro cleans up after a test run. There is only a cleanup if you retest a strategy.
Summary:
Hit "Test" once, hit "Test" again -> memory cleans up.
Hit "Test" once, change strategy, hit "Test again -> no memory clean up
Consider this script and create 4 instances of it. Use the Zorro M1 history data. Run each script once. Zorro will run out of memory.
Code:
void run() { set(TICKS); NumYears = 10; string currentAsset; while(currentAsset=loop("EUR/USD", "XAU/USD", "USD/JPY", "USD/CAD", "GBP/USD", "AUD/USD", "NAS100", "SPX500")) asset(currentAsset); }
The expectation is that Zorro cleans up after a test run. There is only a cleanup if you retest a strategy.
Summary:
Hit "Test" once, hit "Test" again -> memory cleans up.
Hit "Test" once, change strategy, hit "Test again -> no memory clean up