Skip to content

Commit c8dce0c

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

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
@@ -3274,15 +3274,14 @@ bool CacheAllocator<CacheTrait>::markMovingForSlabRelease(
32743274
// At first, we assume this item was already freed
32753275
bool itemFreed = true;
32763276
bool markedMoving = false;
3277-
TierId tid = 0;
3278-
const auto fn = [&markedMoving, &itemFreed, &tid, this /* TODO - necessary for getTierId */](void* memory) {
3277+
TierId tid = getTierId(alloc);
3278+
const auto fn = [&markedMoving, &itemFreed](void* memory) {
32793279
// Since this callback is executed, the item is not yet freed
32803280
itemFreed = false;
32813281
Item* item = static_cast<Item*>(memory);
32823282
if (item->markMoving()) {
32833283
markedMoving = true;
32843284
}
3285-
tid = getTierId(*item);
32863285
};
32873286

32883287
auto startTime = util::getCurrentTimeSec();

0 commit comments

Comments
 (0)