Hi Daniel,
I am using async module to continue the transaction in
asynchronously. But I am observing a leak in shared memory. Then i checked
the code, we are not freeing the async_item_t after calling t_continue.
Same this has checked with MEMDBG=1.
Original code:
while(1) {
lock_get(&_async_list_head->ring[slot].lock);
ai = _async_list_head->ring[slot].lstart;
if(ai!=NULL)
_async_list_head->ring[slot].lstart = ai->next;
lock_release(&_async_list_head->ring[slot].lock);
if(ai==NULL)
break;
if(ai->act!=NULL)
tmb.t_continue(ai->tindex, ai->tlabel, ai->act);
}
Changed code:
while(1) {
lock_get(&_async_list_head->ring[slot].lock);
ai = _async_list_head->ring[slot].lstart;
if(ai!=NULL)
_async_list_head->ring[slot].lstart = ai->next;
lock_release(&_async_list_head->ring[slot].lock);
if(ai==NULL)
break;
if(ai->act!=NULL)
{
tmb.t_continue(ai->tindex, ai->tlabel, ai->act);
shm_free(ai); /* Added by surendra */
}
}
Please correct this if I am wrong.
Regards
@surendra
Show replies by date