2018-02-06 10:21:50 +03:00
|
|
|
;; This test is special because it requires it's own run.
|
|
|
|
;; It initializes a global with a something that needs to allocate memory and call functions,
|
|
|
|
;; then checks that the memory balance is correct after the init step.
|
|
|
|
|
2019-10-31 12:23:23 +03:00
|
|
|
(def g (copy (Array.unsafe-nth &[@"A" @"B" @"C"] 1)))
|
2018-02-06 10:21:50 +03:00
|
|
|
|
|
|
|
;; The one allocation left after 'carp_init_globals' should be 'g' itself:
|
|
|
|
(defn main []
|
2020-05-15 02:22:10 +03:00
|
|
|
(do
|
2020-12-20 23:21:14 +03:00
|
|
|
(Debug.log-memory-balance! true)
|
2020-05-15 02:22:10 +03:00
|
|
|
(assert (= 1l (Debug.memory-balance)))
|
|
|
|
0))
|