41 lines
1.6 KiB
Plaintext
41 lines
1.6 KiB
Plaintext
;;;; A dev build counts what a library's Load calls hand out against its Unload
|
|
;;;; calls, and says at exit what was never released and where it was loaded.
|
|
;;;;
|
|
;;;; Released, and so not reported: a, whose fields other than its pointer are
|
|
;;;; set before it is unloaded; b, changed in place by thing-grow; tx, a
|
|
;;;; pointerless Tex known by its id, whose width is set; the model, which took
|
|
;;;; the mesh over, with its count set and set back; and the buffers, which are
|
|
;;;; not resources. Reported: c, loaded and never unloaded; the clipboard Thing,
|
|
;;;; a Get that hands over a new one; on the last line, a Tex loaded inside
|
|
;;;; the arguments of a Thing's load, each named by its own column; and the
|
|
;;;; unload of the library's own Thing, which nothing loaded.
|
|
;;;;
|
|
;;;; The report is off unless FLAN_DEV_LEAKS is set, and a release build has
|
|
;;;; nothing to report either way.
|
|
(import res "pkgs/res")
|
|
|
|
(defn main [] i32
|
|
(let [a (res/load-thing 1)
|
|
b (res/load-thing 2)
|
|
c (res/load-thing 3)
|
|
tx (res/load-tex 8)
|
|
clip (res/get-clipboard-image)
|
|
m (res/load-model-from-mesh (res/gen-mesh-thing))
|
|
p (res/load-bytes 8)]
|
|
(set (.w a) 9.0)
|
|
(set (.flag a) 0)
|
|
(set (.id a) 7)
|
|
(res/thing-grow (addr b))
|
|
(set (.width tx) 99)
|
|
(set (.count m) 0)
|
|
(set (.count m) 1)
|
|
(res/unload-thing a)
|
|
(res/unload-thing b)
|
|
(res/unload-tex tx)
|
|
(res/unload-model m)
|
|
(res/unload-bytes p)
|
|
(res/unload-thing (res/get-default-thing))
|
|
(println (.id (res/load-thing (.width (res/load-tex 5)))))
|
|
(println "done"))
|
|
0)
|