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

Method __do_allocate

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

Source from the content-addressed store, hash-verified

158}
159
160void* unsynchronized_pool_resource::__adhoc_pool::__do_allocate(memory_resource* upstream, size_t bytes, size_t align) {
161 const size_t footer_size = sizeof(__chunk_footer);
162 const size_t footer_align = alignof(__chunk_footer);
163
164 if (align < footer_align)
165 align = footer_align;
166
167 size_t aligned_capacity = roundup(bytes, footer_align) + footer_size;
168
169 void* result = upstream->allocate(aligned_capacity, align);
170
171 __chunk_footer* h = (__chunk_footer*)((char*)result + aligned_capacity - footer_size);
172 h->__next_ = __first_;
173 h->__start_ = (char*)result;
174 h->__align_ = align;
175 __first_ = h;
176 return result;
177}
178
179void unsynchronized_pool_resource::__adhoc_pool::__do_deallocate(
180 memory_resource* upstream, void* p, size_t bytes, size_t align) {

Callers 1

do_allocateMethod · 0.80

Calls 2

roundupFunction · 0.85
allocateMethod · 0.45

Tested by

no test coverage detected