Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Memory leak in strat analyser

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

    Memory leak in strat analyser

    Hi,
    I'm testing a strat and I'm finding that NT (or me) has a memory leak. I say NT, because even after I close the analyzer the used memory is not recovered. I can only go through a few tests before it starts eating upward of 16 gig of ram. Even if I had a leak in my code (I don't see how, I'm not doing anything fancy), it wouldn't eat that much memory (wink, wink). Interestingly, when I run backtests instead of optimizations, the problem does not seem to occur as bad. It eats some memory, but when I exist the analyzer. It seems to recover.

    More info. My strat loaded an indicator and calls AddChartIndicator in the state.config of onstatechange. I didn't have this problem in B10.

    In any case, as it eats more memory, it become unstable until eventually, NT just crashes out.

    Is anyone else seeing this?

    Thanks ... Ed

    #2
    Hello Support,

    I have been experiencing the same problem.

    Memory gets eaten up while optimizing with B11, and then sometimes is never released back to the system.

    I've uploaded a screen scrape of my taskmgr showing memory consumption.

    I took this screen capture after on optimization of 6500 iterations and then closing the workspace I was using.

    Even after closing the optimization workspace and only sitting in a new and empty "untitled" workspace, the 13.3 gig of storage was still not released by NT.

    NT became really sluggish and unresponsive, but I was still able to slowly close it down.

    Only then was storage relased
    Attached Files

    Comment


      #3
      Hello,

      Thank you for the posts on this.

      I wanted to check if you tried the SampleMACrossOver and had the same result while optimizing or if this is specific to a single strategy? if you have not yet, could you test with the SampleMA and check if you can confirm a similar result? I would be interested to see the settings used to further investigate this.

      Otherwise if this is a custom strategy using a custom indicator, it may help narrow down what is happening to check if this is something being caused by the indicator, you could substitute the indicators being used with a system indicator like the SMA as a test.


      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        I'll do some testing and get back to you as soon as I can.
        Thanks ... Ed

        Comment


          #5
          Hello Jesse,

          I’ve narrowed down the problem of the memory leak.

          I’ve uploaded a clone of SampleMACrossover called “MySampleXCrossLeak”, that includes settings I need to use for my strategy, in OnStateChange.

          I’ve also uploaded a small additional indicator called AuDrawDOW. All it does is draws a vertical line on the chart to separate Days of the week. It’s been added to MySampleXCrossLeak as AddChartIndicator(AuDrawDOW(5)).

          The memory leak is caused by statements:
          1. ForcePlotsMaximumBarsLookBackInfinite = true;
          2. AddChartIndicator(AuDrawDOW(5));


          To test MySampleXCrossLeak, I’ve also included a screen print of the settings to use (“MemLeak Test Start Screen.JPG”).

          Steps…
          1. Restart NT8B11 and open a new Strategy Analyzer Window
          2. Note to amount of memory NT is using via the TaskMgr (For my PC its 5/15.9 GB)
          3. Run MySampleXCrossLeak using the settings outlined by the screen print I uploaded, It will perform 6916 iterations.
          4. Note to amount of memory NT is using via the TaskMgr (For my PC its 8.6/15.9 GB, see “MemLeak Test Start End.JPG”)
          5. Now Close out the Strategy Analyzer Window, to release storage
          6. Note the amount of memory now being consumed by NT via the TaskMgr (For my PC its 6.3/15.9 GB, see “MemLeak Test Stoage Not all released.JPG”)


          Approx. 1.3GB is still be held by NT. Repeat the test again, without restarting NT, and it will approximately double to 2.6GB.

          Finally, you will now also find that NT has become very sluggish and unresponsive.

          Click the screen cast below to see how NT try's to close and finally release to leaked memory http://screencast.com/t/udwE6cPdnv

          The root cause seems to be the combination of the “drawing” indicator AuDrawDOW and the use of ForcePlotsMaximumBarsLookBackInfinite = true

          I wasn’t experiencing this memory leak problem with B10 since all the “Draw” methods where having problems with B10 and I could not use AddChartIndicator(AuDrawDOW(5)) with my custom strategy at that time.

          But since the release of B11, I’ve put it back in and it seems to be causing the memory leak problem.

          Can you please test and verify at your end ?

          Please let me know what you find.

          Thank you
          Attached Files

          Comment


            #6
            The test I performed yesterday was with the 64bit version of NT8B11.

            The same test using the 32bit version will crash after 1 iteration with System.OutOfMemoryException

            Can you please take at look at it, test it at your end and let me know.

            Thank you
            Attached Files

            Comment


              #7
              Hello,

              Thank you for providing the steps and sample on this item.

              I have provided this to development for further review, if I have further information I will post back here.

              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Irukandji, Today, 09:34 AM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by RubenCazorla, Today, 09:07 AM
              1 response
              5 views
              0 likes
              Last Post RubenCazorla  
              Started by TraderBCL, Today, 04:38 AM
              3 responses
              25 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by WeyldFalcon, 08-07-2020, 06:13 AM
              11 responses
              1,423 views
              0 likes
              Last Post jculp
              by jculp
               
              Started by BarzTrading, Today, 07:25 AM
              2 responses
              29 views
              1 like
              Last Post BarzTrading  
              Working...
              X