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 rbeckmann05, Yesterday, 06:48 PM
    1 response
    12 views
    0 likes
    Last Post bltdavid  
    Started by llanqui, Today, 03:53 AM
    0 responses
    6 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    15 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Working...
    X