2017-12-23 16:10:44 +03:00
|
|
|
(defmodule Debug
|
|
|
|
|
|
|
|
(defdynamic sanitize-addresses []
|
|
|
|
(add-cflag "-fsanitize=address"))
|
|
|
|
|
|
|
|
(register memory-balance (Fn [] Long))
|
|
|
|
(register reset-memory-balance! (Fn [] ()))
|
2018-01-02 08:54:05 +03:00
|
|
|
(register log-memory-balance! (Fn [Bool] ()))
|
2018-01-02 08:46:01 +03:00
|
|
|
|
|
|
|
(defmacro memory-logged [form]
|
|
|
|
(list 'do
|
2018-01-02 08:54:05 +03:00
|
|
|
'(Debug.log-memory-balance! true)
|
2018-01-02 08:46:01 +03:00
|
|
|
form
|
2018-01-02 08:54:05 +03:00
|
|
|
'(Debug.log-memory-balance! false)))
|
2017-12-23 16:10:44 +03:00
|
|
|
|
2017-12-25 18:33:03 +03:00
|
|
|
(defn trace [x]
|
|
|
|
(do
|
|
|
|
(IO.println &(str &x))
|
|
|
|
x))
|
|
|
|
|
2017-12-23 16:10:44 +03:00
|
|
|
)
|