MCPcopy Create free account
hub / github.com/bytedance/bolt / clear

Method clear

bolt/common/memory/HashStringAllocator.cpp:104–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void HashStringAllocator::clear() {
105 numFree_ = 0;
106 freeBytes_ = 0;
107 cumulativeBytes_ = 0;
108 std::fill(std::begin(freeNonEmpty_), std::end(freeNonEmpty_), 0);
109 for (auto& pair : allocationsFromPool_) {
110 pool()->free(pair.first, pair.second);
111 }
112 allocationsFromPool_.clear();
113 sizeFromPool_ = 0;
114 for (auto i = 0; i < kNumFreeLists; ++i) {
115 new (&free_[i]) CompactDoubleList();
116 }
117 pool_.clear();
118}
119
120void* HashStringAllocator::allocateFromPool(size_t size) {
121 auto ptr = pool()->allocate(size);

Callers

nothing calls this directly

Calls 2

poolFunction · 0.50
freeMethod · 0.45

Tested by

no test coverage detected