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 Management

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

    Memory Management

    How does Ninja 6.5 handle memory allocation and de-allocation?
    For example, I am keeping an array of type Iorder, for which I allocate memory once only in Initialise and set all elements of this array to null initially. Then I store the results of calls to EnterLongStop and EnterShortStop in this array. When a trade completes (which I detemine simply by the value of Close[0], as each trade has a profit target) I reset the appropriate array element to null, so that it can be reused. Will this cause memory leaks? Should I be freeing the memory used by the IOrder structure returned from EnterLongStop and EnterShortStop before setting the array element to null? The reason I ask is that although the strategy works it slows down and eventually hangs the more times I run it.
    Thanks for your help.
    Annette

    #2
    Annette, the memory management is handled by the .NET garbage collection automatically - whenever resources are freed up, the garbage collector can release them on the next run, however we would can't 'force' this process to 'kick' in the IOrder objects would not need explicit resource cleaning from your end.

    Have you isolated the array to be the issue of your memory usage challenges?
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by alifarahani, Today, 09:40 AM
    3 responses
    15 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by RookieTrader, Today, 09:37 AM
    4 responses
    18 views
    0 likes
    Last Post RookieTrader  
    Started by PaulMohn, Today, 12:36 PM
    0 responses
    5 views
    0 likes
    Last Post PaulMohn  
    Started by love2code2trade, 04-17-2024, 01:45 PM
    4 responses
    40 views
    0 likes
    Last Post love2code2trade  
    Started by junkone, Today, 11:37 AM
    3 responses
    25 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X