MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / main

Function main

crates/memtrack/testdata/alloc_cpp/src/main.cpp:25–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25int main() {
26 std::this_thread::sleep_for(std::chrono::seconds(1));
27
28 auto emit_marker = []() {
29 uint8_t* ptr = new uint8_t[0xC0D59EED];
30 black_box(ptr);
31 delete[] ptr;
32 };
33
34 emit_marker();
35
36 // array:
37 uint32_t* allocated = new uint32_t[11111];
38 black_box(allocated);
39 delete[] allocated;
40
41 // single element:
42 uint64_t* var = new uint64_t;
43 black_box(var);
44 delete var;
45
46 // vector:
47 std::vector<uint32_t> vec(22222, 0);
48 black_box(vec.data());
49
50 // aligned allocation (64-byte alignment for cache line):
51 uint8_t* aligned = static_cast<uint8_t*>(aligned_alloc(64, 64 * 512));
52 black_box(aligned);
53 free(aligned);
54
55 emit_marker();
56}

Callers

nothing calls this directly

Calls 1

black_boxFunction · 0.85

Tested by

no test coverage detected