File tree Expand file tree Collapse file tree
libCacheSim/cache/eviction/3LCache Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -307,10 +307,15 @@ void ThreeLCacheCache::evict() {
307307}
308308
309309void ThreeLCacheCache::evict_with_candidate (pair<uint64_t , int32_t > &epair) {
310+ int32_t old_pos = epair.second ;
311+ if (old_pos == -1 ) {
312+ // No valid candidate to evict, avoid segfault
313+ return ;
314+ }
315+
310316 is_sampling = true ;
311317 evict_nums -= 1 ;
312318 uint64_t key = epair.first ;
313- int32_t old_pos = epair.second ;
314319 _currentSize -= in_cache.metas [old_pos]._size ;
315320
316321 pred_map.erase (key);
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ struct MetaExtra {
6666class Meta {
6767 public:
6868 uint64_t _key;
69- int32_t _size;
69+ uint64_t _size;
7070 uint64_t _past_timestamp;
7171 uint16_t _freq;
7272 MetaExtra *_extra = nullptr ;
You can’t perform that action at this time.
0 commit comments