PDA

View Full Version : Best practices for NinjaScript testing. re: memory usage


DaVinci
06-28-2008, 01:49 PM
Not sure if this should be in the ninjascript directory since the underlying purpose involves memory usage of the actual application...

I am writing a strategy based on prerecorded market data that utilizes a total of four barseries objects. My issue is that whenever I make changes to the strategy, recompile, and F5 in the chart window, my memory usage for NT jumps up another ~300MB. I can make changes up to five times before NT memory usage hits ~1.2GB and then throws "out of memory" errors in the Output window. I need to restart the application every five recompiles.

My question is; is there a best practices way of testing strategy development wrt memory usage? I thought by closing the chart window that the garbage collector would free up the memory address space, but it doesnt. Should I be disposing my memory objects manually? If so, are there any examples?

Hope all is well friends.

NinjaTrader_Josh
06-28-2008, 02:24 PM
You should always dispose of any objects you use. http://www.ninjatrader-support.com/HelpGuideV6/Dispose.html
http://www.ninjatrader-support.com/vb/showthread.php?t=5965

For performance tips see this: http://www.ninjatrader-support.com/HelpGuideV6/helpguide.html?PerformanceTips1

Memory optimization is on the list for NT7.