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

Function initialize_emmalloc_heap

system/lib/emmalloc.c:548–563  ·  view source on GitHub ↗

Initialize emmalloc during static initialization. See system/lib/README.md for static constructor ordering.

Source from the content-addressed store, hash-verified

546// Initialize emmalloc during static initialization.
547// See system/lib/README.md for static constructor ordering.
548__attribute__((constructor(47)))
549static void initialize_emmalloc_heap() {
550 // Initialize circular doubly linked lists representing free space
551 // Never useful to unroll this for loop, just takes up code size.
552#pragma clang loop unroll(disable)
553 for (int i = 0; i < NUM_FREE_BUCKETS; ++i) {
554 freeRegionBuckets[i].prev = freeRegionBuckets[i].next = &freeRegionBuckets[i];
555 }
556
557#ifdef EMMALLOC_VERBOSE
558 MAIN_THREAD_ASYNC_EM_ASM(out('initialize_emmalloc_heap()'));
559#endif
560
561 // Start with a tiny dynamic region.
562 claim_more_memory(3*sizeof(Region));
563}
564
565void emmalloc_blank_slate_from_orbit() {
566 MALLOC_ACQUIRE();

Callers 1

Calls 3

claim_more_memoryFunction · 0.85
constructorClass · 0.50
outFunction · 0.50

Tested by

no test coverage detected