MCPcopy Create free account
hub / github.com/bblanchon/ArduinoJson / shrinkToFit

Method shrinkToFit

src/ArduinoJson/Memory/MemoryPoolList.hpp:140–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138 }
139
140 void shrinkToFit(Allocator* allocator) {
141 if (count_ > 0)
142 pools_[count_ - 1].shrinkToFit(allocator);
143 if (pools_ != preallocatedPools_ && count_ != capacity_) {
144 pools_ = static_cast<Pool*>(
145 allocator->reallocate(pools_, count_ * sizeof(Pool)));
146 ARDUINOJSON_ASSERT(pools_ != nullptr); // realloc to smaller can't fail
147 capacity_ = count_;
148 }
149 }
150
151 private:
152 Slot<T> allocFromFreeList() {

Callers

nothing calls this directly

Calls 1

reallocateMethod · 0.45

Tested by

no test coverage detected