Add a global resource scope

This commit is contained in:
Joshua Suskalo 2021-09-16 16:54:13 -05:00
parent 0e2fc6f458
commit 75910f0ab3

View file

@ -50,6 +50,16 @@
^ResourceScope []
(ResourceScope/newImplicitScope))
(defn global-scope
"Constructs the global scope, which will never reclaim its resources.
This scope may be shared across threads, but is intended mainly in cases where
memory is allocated with [[alloc]] but is either never freed or whose
management is relinquished to a native library, such as when returned from a
callback."
^ResourceScope []
(ResourceScope/globalScope))
(defn alloc
"Allocates `size` bytes.