Standalone examples exploring the cost and control of dynamic memory allocation.
Each example is a single self-contained file — paste it into Compiler Explorer to build it, run it, and inspect the generated assembly.
The folder contains following examples:
vector_dyn_mem.cpp— howstd::vectorgrowth triggers repeated allocationsvector_dyn_mem_reserve.cpp— taming reallocation withreserve()vector_pmr.cpp—std::pmrvectors backed by a fixed buffer instead of the heapnew_deleted.cpp— banning heap allocation by deletingoperator newterminate_handler.cpp— a custom terminate handlerinstrument_functions.cpp— tracing calls with function instrumentation (add-finstrument-functionsto the compiler options in Compiler Explorer)