About this question

Reference-Counted Object Pool

Hard · memory_optimization · Quant Developer interview question · memory-management, low-latency, c++

High-frequency trading systems often suffer from latency spikes due to frequent dynamic memory allocation during critical paths. A reference-counted object pool mitigates this by reusing objects, effectively eliminating new and delete overhead. By enforcing Last-In, First-Out (LIFO) reuse, the pool also maximizes cache locality for rapidly recycled trade objects. Task Build a generic ObjectPool<T> class in C++ that manages a pool of reusable objects. It should provide a std::shared_ptr<T> to an