MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / __do_deallocate

Method __do_deallocate

system/lib/libcxx/src/memory_resource.cpp:179–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179void unsynchronized_pool_resource::__adhoc_pool::__do_deallocate(
180 memory_resource* upstream, void* p, size_t bytes, size_t align) {
181 _LIBCPP_ASSERT_NON_NULL(__first_ != nullptr, "deallocating a block that was not allocated with this allocator");
182 if (__first_->__start_ == p) {
183 __chunk_footer* next = __first_->__next_;
184 upstream->deallocate(p, __first_->__allocation_size(), __first_->__align_);
185 __first_ = next;
186 } else {
187 for (__chunk_footer* h = __first_; h->__next_ != nullptr; h = h->__next_) {
188 if (h->__next_->__start_ == p) {
189 __chunk_footer* next = h->__next_->__next_;
190 upstream->deallocate(p, h->__next_->__allocation_size(), h->__next_->__align_);
191 h->__next_ = next;
192 return;
193 }
194 }
195 // The request to deallocate memory ends up being a no-op, likely resulting in a memory leak.
196 _LIBCPP_ASSERT_VALID_DEALLOCATION(false, "deallocating a block that was not allocated with this allocator");
197 }
198}
199
200class unsynchronized_pool_resource::__fixed_pool {
201 struct __chunk_footer {

Callers 1

do_deallocateMethod · 0.80

Calls 2

deallocateMethod · 0.45
__allocation_sizeMethod · 0.45

Tested by

no test coverage detected