Allocation Tracker Resource
What this preview is
Allocation Tracker Resource is a medium quant coding problem on language knowledge in Cpp.
- Difficulty
- Medium
- Topic
- Language Knowledge
- Discipline
- Quant development
- Language
- Cpp
Implementing a memory allocation tracker in C++
This medium-difficulty C++ coding problem tests your ability to implement a decorator-pattern std::pmr::memory_resource that transparently observes and measures allocation behavior. It is representative of instrumentation work in performance-critical systems, where understanding memory consumption in production requires careful, non-intrusive measurement.
The core challenge is to maintain accurate counters for allocations, deallocations, outstanding bytes, and peak memory use while delegating all actual allocation work to an upstream resource. This requires careful state management: you must update counters only after the upstream succeeds (to avoid inconsistency on exception), distinguish between allocation count and deallocation count, and track the high-water mark separately from the current outstanding total. Strong solutions also implement the equality operator correctly and ensure all public query methods are const-correct.
- The polymorphic memory resource protocol and virtual method overrides
- Exception safety and when to update state relative to delegation
- Tracking multiple related metrics (count, bytes outstanding, peak)
- Decorator and observer patterns in C++
Unlock full access to getcracked
Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.