Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Memory Leaks...

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

    Memory Leaks...

    I found a memory leak with Chart opening and closing.

    I'm finding huge memory leaks associated with the Strategy Analyzer but haven't narrowed down to the exact cause yet. It's especially notable, I guess, because I'm using tick data.

    Still I think you have many users who want to use tick data.

    To reproduce the chart leak:

    1. New chart with 6 days of $USDJPY at 1 second.
    2. Watch the NinjaTrader process grow by around 60 Meg.
    3. Close the chart.
    4. See NinjaTrader holds on to all that memory.
    5. Repeat the process.

    It gets larger and larger.

    It seems to free the memory properly if you just change instruments within the same chart.

    Still, I sometimes close and open charts while looking at specific trades (right click on a trade in the trade window) and notice it gobbling up memory each time.

    Please clean up the memory leaks.

    If I narrow down the problem with Strategy Analyzer, I'll let you know. But I think there's more than one.

    Sincerely,
    Wayne

    #2
    Hi wayneFH,

    Memory is handled by the .NET framework. When .NET decides to release the memory it will reduce the NinjaTrader footprint. Work is already being done on optimizing memory usage for NT7.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by wayneFH View Post
      1. New chart with 6 days of $USDJPY at 1 second.
      2. Watch the NinjaTrader process grow by around 60 Meg.
      3. Close the chart.
      4. See NinjaTrader holds on to all that memory.
      5. Repeat the process.
      Please make sure you understand the concept of how .NET runtime manages memory (this is NOT controlled by NT) before you analyze perceived memory leaks: as NT no longer uses memory, the .NET runtime may or may not decide the give it back to the OS. Please consult the MS docs to understand how garbage collection in .NET works.

      Comment


        #4
        Okay. I have experience with Java GC but not C# yet. So. I'll read up on that.

        Still chart closing and open seems to only grow when opening closing charts without ever get GC'd.

        In contrast, when I re-backtest the same amount of data in a strategy, it (improperly) reloads all the same amount of data as the chart.

        In that case, the C# GC works because, first, the footprint grows by 50 meg and then after a couple of seconds, it decreases by the same amount. That's what I expected the charts to do also.

        Have you tried opening and closing a chart with large data amounts? Have you ever seen the memory get GC'd back to the original amount? I doubt it.

        When I try it, the memory only goes UP and it stays there for a very long time. GC should run at regular intervals, right? I'm assuming every few seconds. Is that right? I'll read up on it later today.

        Anyway, after about an hour of working on the Strategy Analyzer with only 1 week of tick data, it eventually gobbles ALL my memory so I have to shut NT down and restart it.

        I never use more than 1 week data and all I'm doing is writing a custom strategy. That means I make changes to the strategy logic or values, re-run the back test, study the trades, graphs, chart, and then repeat the process.

        Again after a couple hours of this NT eats up all my memory with a process footprint of over 700 Megabytes.

        However, NT itself is only about 70 megabytes and my 1 week of data is about 50 megabytes. When I first load the data it takes 120 Meg total.

        WHY? Does it grow to over 600 Meg is a couple hours?

        Anyway, I guess this is slightly lower priority than eating memory during real time trading.

        Sincerely,
        Wayne

        Comment


          #5
          a) Unfortunately I can't comment on how .NET GC works. Please contact MS for details.
          b) Please make sure you are not working an issue which we already acknowledged (related to multi-series) and will be fixed with next update (see the other thread you posted).

          Comment


            #6
            I studied about C# GC. That's not the issue here.
            No, this is not related to the other issue about multi-series because this current memory leak never involved any strategy or indicator.

            You simply load the tick data on the chart as explained below. If you follow those steps outlined to reproduce the problem, you will see that it never includes a step to add any indicator or strategy.

            So simply opening creating a new chart with tick data and closing it repeatedly chews up all the memory in a short time. It never gets GC'd.

            Sincerely,
            Wayne

            Comment


              #7
              The issue fixed has nothing to do with indicators. I suggest retrying after next update.

              >> I studied about C# GC.
              Great. So you now know that GC not triggering is no indication of memory been freed or not by the app.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Waxavi, Today, 02:10 AM
              0 responses
              6 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Started by TradeForge, Today, 02:09 AM
              0 responses
              11 views
              0 likes
              Last Post TradeForge  
              Started by Waxavi, Today, 02:00 AM
              0 responses
              2 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Started by elirion, Today, 01:36 AM
              0 responses
              4 views
              0 likes
              Last Post elirion
              by elirion
               
              Started by gentlebenthebear, Today, 01:30 AM
              0 responses
              5 views
              0 likes
              Last Post gentlebenthebear  
              Working...
              X