Memory Clean Problem

 

Hello,

there is a problem with memory clean for arrays in MT5. My Build is 1931 and if you run this code in backtesting you can see that memory(RAM) increase to maximum allowed.

//+------------------------------------------------------------------+
//|                                        ArrayMemoryCleanError.mq5 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

input string sviluppoProgressioneGriglia = "0.01,0.01,0.02,0.02,0.03,0.04,0.05,0.06,0.08,0.11h,0.14h,0.18h,0.23h,0.30h,0.39h,0.51h";

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{

   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{

}

//+------------------------------------------------------------------+
//|                          Splitta String                          |
//+------------------------------------------------------------------+
void splittaStringa( string stringaSplit, string _separatore, string& _stringOut[] )
{
   string to_split = stringaSplit; // Una stringa per dividere in sottostringhe 
   string sep = _separatore;                // Un separatore come carattere 
   ushort u_sep;                  // Il codice del carattere separatore 
   //--- Ottiene il codice separatore 
   u_sep=StringGetCharacter(sep,0); 
   //--- Divide la stringa in sottostringhe 
   int k=StringSplit(to_split,u_sep,_stringOut); 
}

  
void createLocalArray()
{
   if( 0 == 0 )
   {
      string contratti[];
      splittaStringa( sviluppoProgressioneGriglia, ",", contratti );
   }    
}  

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
   createLocalArray();
}
//+------------------------------------------------------------------+

 i could not find Service Desk page.

 
Metrica Trading Solutions:

Hello,

there is a problem with memory clean for arrays in MT5. My Build is 1931 and if you run this code in backtesting you can see that memory(RAM) increase to maximum allowed.

 i could not find Service Desk page.

There is no service desk anymore, you'll need to comment on the version release thread. Also, this bug is from StringSplit... you should be seeing "n leaked strings" in the log.

 
nicholi shen:

There is no service desk anymore, you'll need to comment on the version release thread. Also, this bug is from StringSplit... you should be seeing "n leaked strings" in the log.

It's a MQL5 bug? i need to Resize to 0 to solve the problem

 
Metrica Trading Solutions:

It's a MQL5 bug? i need to Resize to 0 to solve the problem

This bug is fixed in build 1934.
Reason: