Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Memory Leak

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Memory Leak

    Good morning,

    I run a lot of backtests over a 400 symbol list on the 1min timeframe over a couple year period. I find that running a backtest takes about 30min but uses about 20% of my 128gb of memory, after 2 or 3 backtests NT normally closes during the next backtest. If I close NT before this, it keeps running in the windows task manager after it closes, then I will end task in the task manager and memory will drop a little but will still be at ~30% then on system reboot it is normally about 8%.

    I think I have a memory leak in my code. I have looked into adding State.Terminated in my scripts but that hasn't helped. My custom indicator that my strategy is based off of consists of a couple SMA's and ATR's added along with some custom bools and a 2min and daily timeframe is added to the 1min timeframe

    Is there a direction that someone would recommend me looking into? Or something that I should look up in the help guides? It seems like data is being stored that is no longer needed but I am not sure how to find out which part or what data is being held on to.

    I am somewhat new to this so any help would be greatly appreciated.

    Thanks Ryan

    #2
    Hello Ryan,

    Thanks for your post.

    Please write in to support[at]ninjatrader[dot]com with a brief description of your inquiry, answers to the questions below, and attach your log and trace files using the steps below so I may investigate this further. In the subject of your email include Attn: BrandonH and in the body of your email include a link to this forum thread.
    • What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.0.?.?)​
    • Are you running backtests or optimizations?
    • Can you reproduce the behavior when testing the SampleMACrossover strategy that comes default with NinjaTrader?
      • If so, what are the exact steps and settings you are using to reproduce the behavior?
    • Do you close NinjaTrader while it is in the middle of a backtest or optimization when this occurs?
    Follow the steps below to manually attach your log and trace files to your response so I may investigate this matter further.
    • Open your NinjaTrader folder under, "Documents" (sometimes called, "My Documents")
    • Right click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
    • Send the 2 compressed folders as attachments to this email.
    • Once complete, you can delete these compressed folders.
    I look forward to assisting further.​
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      You could compile your code in debug mode, then attach a debugger and see what it's doing during that time. Do you use any locks? Or any invokes? Those are the places I would look first if you think your code is hanging. If you do not use unmanaged resources, then you can't really cause a memory leak unless you're keeping references somewhere e.g. a static list or the like. You could experiment with calling GC.Collect() every X iterations e.g. every 100 iterations. Strategy Analyzer doesn't do this so it runs as fast as possible, but it does also use basically all of the resources.
      Bruce DeVault
      QuantKey Trading Vendor Services
      NinjaTrader Ecosystem Vendor - QuantKey

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Segwin, 05-07-2018, 02:15 PM
      14 responses
      1,789 views
      0 likes
      Last Post aligator  
      Started by Jimmyk, 01-26-2018, 05:19 AM
      6 responses
      837 views
      0 likes
      Last Post emuns
      by emuns
       
      Started by jxs_xrj, 01-12-2020, 09:49 AM
      6 responses
      3,294 views
      1 like
      Last Post jgualdronc  
      Started by Touch-Ups, Today, 10:36 AM
      0 responses
      13 views
      0 likes
      Last Post Touch-Ups  
      Started by geddyisodin, 04-25-2024, 05:20 AM
      11 responses
      63 views
      0 likes
      Last Post halgo_boulder  
      Working...
      X