Skip to content

Commit ab25b3c

Browse files
igchorguptask
authored andcommitted
Fix slab release code
Get tier id of item before calling any function on allocator (which needs the tierID).
1 parent f2ff924 commit ab25b3c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cachelib/allocator/CacheAllocator-inl.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3329,15 +3329,14 @@ bool CacheAllocator<CacheTrait>::markMovingForSlabRelease(
33293329
// At first, we assume this item was already freed
33303330
bool itemFreed = true;
33313331
bool markedMoving = false;
3332-
TierId tid = 0;
3333-
const auto fn = [&markedMoving, &itemFreed, &tid, this /* TODO - necessary for getTierId */](void* memory) {
3332+
TierId tid = getTierId(alloc);
3333+
const auto fn = [&markedMoving, &itemFreed](void* memory) {
33343334
// Since this callback is executed, the item is not yet freed
33353335
itemFreed = false;
33363336
Item* item = static_cast<Item*>(memory);
33373337
if (item->markMoving()) {
33383338
markedMoving = true;
33393339
}
3340-
tid = getTierId(*item);
33413340
};
33423341

33433342
auto startTime = util::getCurrentTimeSec();

0 commit comments

Comments
 (0)