Attached is a Zip file containing a MovingAverageCrossover Strategy along with a simple indicator which demonstrates the Memory Leak issue with the Optimizer, which I have previously reported.
I loaded Ninjatrader from a cold start. Prior to starting the Optimizer it was using 408Mb.
After 600 Optimizer iterations on "MA Cross Mem Leak" (Fast:200 Slow:200 / ES 12-18 / 1 min / 3-Dec-18 to 7-Dec-18) Memory usage was 4.71Gb and the optimization process was getting slower and slower.
I generated the following Dump file:
This indicates 600 Strategy Instances, 600 Indicator instances, 3 Million Line Drawing Objects and 7 Million Chart Anchors all allocated on the heap.
The memory leaks seems to be caused by a NinjascriptDrawingToolDictionary instance (optimizerInstanceDrawnTools). This type has a Dictionary of entries. The Key of the Dictionary is the indicator which drew the line, and value is a dictionary of drawn objects. The indicator has a reference to the strategy.
Note that I'm using IsInstantiatedOnEachOptimizationIteration = true
Comment