MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / containerMalloc

Method containerMalloc

include/sonic/dom/dynamicnode.h:520–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

518
519 template <typename T>
520 sonic_force_inline void* containerMalloc(size_t cap, Allocator& alloc) {
521 size_t alloc_size = cap * sizeof(T) + sizeof(MetaNode);
522 void* mem = alloc.Malloc(alloc_size);
523 // init Metanode
524 MetaNode* meta = static_cast<MetaNode*>(mem);
525 new (meta) MetaNode(cap);
526
527 return mem;
528 }
529
530 template <typename T>
531 sonic_force_inline void* containerRealloc(void* old_ptr, size_t old_cap,

Callers

nothing calls this directly

Calls 1

MallocMethod · 0.45

Tested by

no test coverage detected