Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

The Reason Why Ninjatrader 7 crashes when too many Charts/DOMs are open

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

    The Reason Why Ninjatrader 7 crashes when too many Charts/DOMs are open

    Hi guys,

    I have had this problem for several years now and due to some unimaginable luck I managed to find the source of the issue.

    The problem was that I am using many Workspaces. I would like to have 15-20 Workspaces open at the same time. Each Workspace has 6-8 Charts, 1 DOM and 1 Market Analyzer.
    What I experiences is that for some reason after 11 or 12 Workspaces were opened, Ninja crashes when I tried to open more. Also, even when I had only opened the number of Workspaces I fould would not crash NT7, after a while NT7 still crashed when I clicked on a Chart, right-clicked, opened a Dialog, whatever. It was maddening.

    Also, I had read similar threads previously and it seemed to me that the Ninja guys may not be aware of this. Their usual answer is that there is no limit in the program on how many Charts/DOMs can be open at the same time. And they are right, because the limitation is imposed by the operating system.

    So what I did is after multiple such crashes, I looked at the Trace file and I found this error message:

    "Error creating window handle"

    So I started getting deep into when this messages comes, what causes it and what could be a possible solution.
    So basically every application creates so-called "User Objects". If you look at a Dialog, there are many fields, texts, buttons, etc., these are all Objects NT7 creates. When you have many Charts and many DOMs open, thousands upon thousands of these User Objects are created by NT7.

    As it turns out, Windows has a limitation on how many User Objects a single application can create. By default this is set to 10,000. And when an application reaches this limit, it cannot create additional User Objects when it would need to to operate correctly and in such cases it can and usually does crash.

    Fortunately for me, Windows 10 lets you see how many User Objects an application is using (I think this was not available in Win7 yet). In the Task Manager, go to the Details Tab, right-click into the Title Row and select the "Select Columns" command. In the upcoming Dialog, find the "User Objects" item and check the checkbox before it. Click OK. Now you will be able to see how many User Objects NT is using.

    What I found is that opening an above mentioned Workspace normally created about 700 new User Objects. Other parts of Ninja created about 1000-1500 of them, so after opening 12 Workspaces, I was already at 10,000.
    Then opening the Data Series Dialog, the Indicators Dialog or some other Dialog could push the number over 10,000 and boom, crash, like clockwork.

    Now that I saw how the User Object count changes depending on what I open I started checking things to see what is creating many User Objects.
    For me, a Chart with about 7-8-9 Indicators usually creates about 40 User Objects.
    However, a single DOM can create 300-350 User Objects. As far as I could figure it out, the more rows the DOM has, the more User Objects created.

    So this is why 1 Workspace created 700 User Objects, half of which was created by the DOM only. If you open about 30 DOMs, each of which has 40 rows, it will reach the User Objects limit.

    So obviously my solution was to turn off the DOMs in all those Workspaces. The result: I have now 18 Workspaces open, each of them with 6 Charts and a simple Marker Analyzer Window, and NT7 is at about 5,400 User Objects. No crashes or hangs since.

    It may also be worth mentioning that applications create not only these User Objects, but so-called "GDI Objects" and "Handles" as well. These too can hit the upper limit of 10,000. Win10's Task Manager lets you see these as well in their own columns in the Details Tab, bring them up in a similar fashion as described earlier with User Objects.
    In case of NT7, User Objects was the thing that reached the limit. As an example, right now my NT7 has 5,400 User Objects, 2,460 GDI Objects, and 1,000 Handles, so the last 2 did not cause the issues.

    By the way, Ninjatrader 8 does not seem to have this problem, probably because its user interface has been totally rewritten. Even when 18 Workspaces are open, each with the 6 charts, 1 DOM, 1 Marker Analyzer, it uses only about 2,000 User Objects. In NT7 the same would require about 12-13,000 User Objects by my estimation.

    I hope that this information will be useful for people having similar issues.

    #2
    I remember some post related to number of objects years ago.

    Comment


      #3
      This one?:



      My experience is that he should have increased the value of the

      USERProcessHandleQuota
      (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\C urrentVersion\Windows\USERProcessHandleQuota)


      variable instead of the

      GDIProcessHandleQuota
      (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\C urrentVersion\Windows\GDIProcessHandleQuota)


      As I mentioned above, it is the number of User Objects that is causing the trouble, not the number of GDI Objects.

      Comment


        #4
        It was I who raised an issue here: http://ninjatrader.com/support/forum...ad.php?t=45297

        I think he has found the answer to that one too.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by GussJ, 03-04-2020, 03:11 PM
        15 responses
        3,271 views
        0 likes
        Last Post xiinteractive  
        Started by Tim-c, Today, 02:10 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Taddypole, Today, 02:47 PM
        0 responses
        2 views
        0 likes
        Last Post Taddypole  
        Started by chbruno, 04-24-2024, 04:10 PM
        4 responses
        51 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        10 responses
        403 views
        1 like
        Last Post beobast
        by beobast
         
        Working...
        X