Are they bugs or anything else?

 

When I run the example code "Check_GetPointer.mq5" of the help file ,There are something wrong printed out . How to fix it?

the log message as below:

 

2010.01.25 16:57:27 Check_Pointer (EURGBP,M1) 32 bytes of leaked memory 

2010.01.25 16:57:27 Check_Pointer (EURGBP,M1) 2 undeleted objects left

Files:
 

Thank you for your message, fixed. Please wait for updates.

 
mql5:

Thank you for your message, fixed. Please wait for updates.

These Bugs are still there with build 241.I have rebuilt the code again.

 

 2010.01.29 00:14:06 Check_Pointer (EURGBP,M30) 36 bytes of leaked memory
2010.01.29 00:14:06 Check_Pointer (EURGBP,M30) 1 undeleted objects left

 

We have updated the example for fuction GetPointer, see there:

//+------------------------------------------------------------------+
//|                                             Check_GetPointer.mq5 |
//|                        Copyright 2009, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2009, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
 
//+------------------------------------------------------------------+
//|  class implementing the list element                             |
//+------------------------------------------------------------------+
class CItem
  {
   int               m_id;
   string            m_comment;
   CItem*            m_next;
public:
                     CItem() { m_id=0; m_comment=NULL; m_next=NULL; }
                    ~CItem() { Print("Destructor of",m_id,
                                     (CheckPointer(GetPointer(this))==POINTER_DYNAMIC)?
                                     "dynamic":"non-dynamic"); }
   void              Initialize(int id,string comm) { m_id=id; m_comment=comm; }
   void              PrintMe() { Print(__FUNCTION__,":",m_id,m_comment); }
   int               Identifier() { return(m_id); }
   CItem*            Next() {return(m_next); }
   void              Next(CItem *item) { m_next=item; }
  };
//+------------------------------------------------------------------+
//|  simplest class of the list                                      |
//+------------------------------------------------------------------+
class CMyList
  {
   CItem*            m_items;
public:
                     CMyList() { m_items=NULL; }
                    ~CMyList() { Destroy(); }
    bool             InsertToBegin(CItem* item);

protected:
    void             Destroy();
  };
//+------------------------------------------------------------------+
//|  inserting list element at the beginning                         |
//+------------------------------------------------------------------+
bool CMyList::InsertToBegin(CItem* item)
  {
   if(CheckPointer(item)==POINTER_INVALIDreturn(false);
//---
   item.Next(m_items);
   m_items=item;
//---
   return(true);
  }
//+------------------------------------------------------------------+
//|  deleting the list by deleting elements                          |
//+------------------------------------------------------------------+
void CMyList::Destroy()
  {
//--- service pointer to work in a loop
   CItem* item;
//--- go through the loop and try to delete dynamic pointers
   while(CheckPointer(m_items)!=POINTER_INVALID)
     {
      item=m_items;
      m_items=m_items.Next();
      if(CheckPointer(item)==POINTER_DYNAMIC)
        {
         Print("Dynamyc object",item.Identifier(),"to be deleted");
         delete (item);
        }
      else Print("Non-dynamic object",item.Identifier(),"cannot be deleted");
     }
//---
  }
//+------------------------------------------------------------------+
//|  Script program start function                                   |
//+------------------------------------------------------------------+
void OnStart()
  {
   CMyList list;
   CItem   items[10];
   CItem*  item;
//--- create and add into the list a dynamic object pointer
   item=new CItem;
   if(item!=NULL)
     {
      item.Initialize(100,"dynamic");
      item.PrintMe();
      list.InsertToBegin(item);
     }
//--- add automatic pointers into the list
   for(int i=0; i<10; i++)
     {
      items[i].Initialize(i,"automatic");
      items[i].PrintMe();
      item=GetPointer(items[i]);
      if(CheckPointer(item)!=POINTER_INVALID)
         list.InsertToBegin(item);
     }
//--- add one more dynamic object pointer at the list beginning
   item=new CItem;
   if(item!=NULL)
     {
      item.Initialize(200,"dynamic");
      item.PrintMe();
      list.InsertToBegin(item);
     }
//--- delete all the list elements
   list.Destroy();
//--- all the list elements will be deleted after the script is over
//--- see the Experts tab in the terminal
  }


 

Thanks for reply.