MCPcopy Create free account
hub / github.com/IntegralPilot/wasm_os / operator new

Function operator new

stdlib/cpp/new.hpp:26–32  ·  view source on GitHub ↗

Custom global new operator

Source from the content-addressed store, hash-verified

24
25// Custom global new operator
26void* operator new(std::size_t size) {
27 void* ptr = malloc(size);
28 if (reinterpret_cast<int>(ptr) < 0) {
29 throw std::bad_alloc();
30 }
31 return ptr;
32}
33
34// Custom global new[] operator
35void* operator new[](std::size_t size) {

Callers

nothing calls this directly

Calls 2

mallocFunction · 0.85
bad_allocClass · 0.85

Tested by

no test coverage detected