[AGENT++] how to release the content int table?

黄俊源 hyznull at hotmail.com
Mon Mar 25 02:50:38 CET 2013


hi. 
i have a problem in reset the content.i found the content.clear() cant not release the memory.myrun run server times ,i found my program have a memory leak in top.what shall i do to release the memory?
in my code like this.is it right?


class DynamicTable:public Mibtable
{
//...
void reset();
};


void DynamicTable::reset()
{
    start_synch();
    content.clear();
    while(int i = 0;i < m_size;i++)
    {
        MibTableRow *r = new MibTableRow(generator);
        r->set_index(my_index);
        r->get_nth(leaf1)->replace_value(new Snmp_pp::OctetStr("abc"));
        r->get_nth(leaf2)->replace_value(new Snmp_pp::OctetStr("abc"));
        //.....
        r->get_nth(leafn)->replace_value(new Snmp_pp::OctetStr("abc"));
        content.add(r);
    }
    end_synch();
}
 
void myrun()
{
   while(1)
   {
      Dynamic::instance->reset();
      sleep(10);
   }
}
 
  		 	   		  


More information about the AGENTPP mailing list