blob: bacaf361d4a88c676eeb1db1c6211c93fe64836a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "lid_hold_list.h"
#include "lidstatevector.h"
#include <cassert>
namespace proton {
LidHoldList::LidHoldList() = default;
LidHoldList::~LidHoldList() = default;
void
LidHoldList::add(const uint32_t data, generation_t generation) {
if (!_holdList.empty()) {
assert(generation >= _holdList.back().second);
}
_holdList.emplace_back(data, generation);
}
void
LidHoldList::clear() {
_holdList.clear();
}
void
LidHoldList::reclaim_memory(generation_t oldest_used_gen, LidStateVector &freeLids)
{
while (!_holdList.empty() && _holdList.front().second < oldest_used_gen) {
uint32_t lid = _holdList.front().first;
freeLids.setBit(lid);
_holdList.pop_front();
}
}
}
|