flan/test/programs/string-leak.flan

17 lines
607 B
Plaintext

;;;; A dev build's registry names a String's block by its type: the one freed
;;;; is gone from the report at exit, and the ones kept — made by string-new, by
;;;; a prelude builder and by bytes->string — are listed under String.
(defn main [] i32
(let [kept (string-new "kept")
gone (string-new "gone")]
(append kept " for good")
(free gone)
(println kept)
;; A builder's answer and a checked copy are Strings in the report too.
(println (to-upper (bytes-view "loud")))
(let [v (vec-new u8)]
(push v 0x61)
(println (bytes->string v))
(free v)))
0)