About this question
Hard · memory_optimization · Quant Developer interview question · c++17, memory, pointers, optimization
Heap allocations on the critical path introduce non-deterministic latency due to lock contention and system calls, which is unacceptable in high-frequency trading systems. C++17 Polymorphic Memory Resources (PMR) allow developers to redirect allocations to pre-allocated stack buffers, ensuring deterministic execution times by avoiding the heap entirely. Task Implement a custom std::pmr::memory_resource class named StackMonotonicResource that manages a fixed-size memory buffer. The allocator mus