Debug
is a module that provides functions and commands to debug faulty programs and functions.
assert-balanced
Macro
(assert-balanced form)
raises an error if the memory balance (number of alloc
s - number of free
s) isn't 0
. Requires the flag --log-memory
to be passed durng compilation.
check-allocations
Dynamic
(check-allocations)
will check the allocations made by the program
immediately, raising a SIGABRT
if it fails.
leak-array
(Fn [a] ())
leaks some memory. This function is useful for testing tools that detect leaks.
memory-logged
Macro
(memory-logged form)
logs all calls to memory allocation within the form. Requires the flag --log-memory
to be passed during compilation.
sanitize-addresses
Dynamic
(sanitize-addresses)
instructs the compiler to sanitize addresses.
This might not work on all compilers, but reasonably new versions of GCC and Clang are supported.