=============== Debug Allocator =============== :: #import "std/debug_allocator" Debug allocator can be used to analyze memory usage of program and eventually analyze possible memory leaks. By :ref:`dbgalloc_init` call the global `context` allocator is replaced by debug allocator, every following allocations are recorded and analyzed in runtime since then. Call :ref:`dbgalloc_terminate` to swap default context allocator back to previous one. Example ------- .. literalinclude:: /examples/docs/003.bl :language: bl :: $ ./out.exe ******************* MEMORY REPORT ****************** * Allocated 64 Bytes. * Count of allocations 1. **************************************************** Dump memory leaks begin: [1] - test.bl:10 (64 bytes) Dump memory leaks end. .. note:: Debug allocator is thread safe. Init and terminate must be called from main thread. .. toctree:: :glob: :titlesonly: debug_allocator/*