From: bdemsky Date: Mon, 28 Mar 2011 22:56:15 +0000 (+0000) Subject: memory leaks for rentry X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=579ea5500a0bcf4ad2a7fd223028959ae38b1ac1;p=IRC.git memory leaks for rentry --- diff --git a/Robust/src/Runtime/mlp_runtime.c b/Robust/src/Runtime/mlp_runtime.c index 4668f30c..28010956 100644 --- a/Robust/src/Runtime/mlp_runtime.c +++ b/Robust/src/Runtime/mlp_runtime.c @@ -549,6 +549,9 @@ int ADDVECTOR(MemoryQueue *Q, REntry *r) { if (isParentCoarse(r)) { //parent's retire immediately atomic_dec(&V->item.total); V->index--; + } else { + if (atomic_sub_and_test(1, &r->count)) + poolfreeinto(Q->rentrypool, r); } return READY; } else { @@ -580,6 +583,8 @@ int ADDSCC(MemoryQueue *Q, REntry *r) { void* flag=NULL; flag=(void*)LOCKXCHG((unsigned INTPTR*)&(S->val), (unsigned INTPTR)flag); if (flag!=NULL) { + if (atomic_sub_and_test(1, &r->count)) + poolfreeinto(Q->rentrypool, r); return READY; } else { return NOTREADY;//<- means that some other dispatcher got this one...so need to do accounting correctly