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

hyznull hyznull at hotmail.com
Wed Mar 27 02:31:22 CET 2013


> Hi,Jochen I have try MibTable::clear() or content.clearAll(),and it
> works.But the memory still keepin the program.The memory will not go

> down!When add new row into the content,the memorywill increase even
> double.At the end ,the system will restart.(my data is
> large)

>from your code, the reason for increasing memory usage could be, that
>you add multiple rows with the same index my_index. Can you verify that
>after your loop, content has m_size entries?
 
Hi,Jochen
Thanks for reply.
The dummy code in my pre-mail is some wrong to misguide you.
The really means dummy code may like this.
 
void DynamicTable::reset()
{
    start_synch();
    content.clear();
    for(int i = 0;i < g_memory().size();i++)
    {
        MibTableRow *r = new MibTableRow(generator);
        Oidx new_index = g_memory.GetIndex();
        r->set_index(new_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();
}

Thanks 

 		 	   		  


More information about the AGENTPP mailing list