Bypass tcache when draining quarantined allocations.

This avoids the potential surprise of deallocating an object with one
tcache specified, and having the object cached in a different tcache
once it drains from the quarantine.
This commit is contained in:
Jason Evans 2015-05-29 17:49:18 -07:00
parent c073f8167a
commit 09983d2f54

View File

@ -98,7 +98,7 @@ quarantine_drain_one(tsd_t *tsd, quarantine_t *quarantine)
{ {
quarantine_obj_t *obj = &quarantine->objs[quarantine->first]; quarantine_obj_t *obj = &quarantine->objs[quarantine->first];
assert(obj->usize == isalloc(obj->ptr, config_prof)); assert(obj->usize == isalloc(obj->ptr, config_prof));
idalloc(tsd, obj->ptr); idalloctm(tsd, obj->ptr, NULL, false);
quarantine->curbytes -= obj->usize; quarantine->curbytes -= obj->usize;
quarantine->curobjs--; quarantine->curobjs--;
quarantine->first = (quarantine->first + 1) & ((ZU(1) << quarantine->first = (quarantine->first + 1) & ((ZU(1) <<
@ -123,7 +123,7 @@ quarantine(tsd_t *tsd, void *ptr)
assert(opt_quarantine); assert(opt_quarantine);
if ((quarantine = tsd_quarantine_get(tsd)) == NULL) { if ((quarantine = tsd_quarantine_get(tsd)) == NULL) {
idalloc(tsd, ptr); idalloctm(tsd, ptr, NULL, false);
return; return;
} }
/* /*
@ -162,7 +162,7 @@ quarantine(tsd_t *tsd, void *ptr)
} }
} else { } else {
assert(quarantine->curbytes == 0); assert(quarantine->curbytes == 0);
idalloc(tsd, ptr); idalloctm(tsd, ptr, NULL, false);
} }
} }