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

Method Malloc

include/sonic/allocator.h:39–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37class SimpleAllocator {
38 public:
39 void* Malloc(size_t size) {
40 void* ptr = nullptr;
41 if (size != 0) {
42 ptr = std::malloc(size);
43 }
44#ifdef SONIC_UNITTEST
45 if (ptr != nullptr) {
46 std::memset(ptr, 'z', size);
47 }
48#endif
49 return ptr;
50 }
51
52 void* Realloc(void* old_ptr, size_t old_size, size_t new_size) {
53 (void)(old_size);

Callers 9

MemoryPoolAllocatorMethod · 0.45
AddChunkMethod · 0.45
allocateMethod · 0.45
allocateStringBufferMethod · 0.45
CreateMapMethod · 0.45
containerMallocMethod · 0.45
StringCopyMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected