Memory leak when adding a row...

Michael Grimes mgrimes____onemain.com
Tue Jun 17 22:32:44 CEST 2003


I believe I have discovered a memory leak that occurs when a row is 
created.  I am
sending a set request that contains 6 columns for the same index.  The row 
status
column is set to create and go.  Ultimately, the MibLeaf::set method is 
called to set the
column values.  In this method, undo is set to value->clone().  This is the 
memory
that is never deleted.  The undo for the 1st column in the request gets 
deleted, but
the remaining 5 columns do not.  In the Mib::process_prepare_set_request 
method, it appears
that only the 1st sub-request gets locked (req->set_locked(i, 
entry)).  Later, when the
method Mib::process_cleanup_set_request is called, only the locked entry 
gets a call to
it's cleanup_set_request, where it's undo is eventually deleted.  I was 
able to fix this leak
by making the following change:

void MibTable::cleanup_set_request(Request* req, int& ind)
{
    MibLeaf *o;

    for (int i = 0; i < req->subrequests(); i++)
    {
       if ((o = find(req->get_oid(i))) != 0)
       {
          o->cleanup_set_request(req, i);
       }
    }

    delete_rows.clear();
}

This removed the leftover undo's.  However, this is probably not the 
preferred fix.
I believe the problem is related to the locking.

Thanks for your help,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.agentpp.org/pipermail/agentpp/attachments/20030617/c91d0d40/attachment.htm 


More information about the AGENTPP mailing list