aboutsummaryrefslogtreecommitdiff
path: root/core/os/heap.odin
diff options
context:
space:
mode:
Diffstat (limited to 'core/os/heap.odin')
-rw-r--r--core/os/heap.odin22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/os/heap.odin b/core/os/heap.odin
new file mode 100644
index 000000000..356e60b4d
--- /dev/null
+++ b/core/os/heap.odin
@@ -0,0 +1,22 @@
+package os
+
+import "base:runtime"
+
+/*
+ Returns the default `heap_allocator` for this specific platform.
+*/
+@(require_results)
+heap_allocator :: proc() -> runtime.Allocator {
+ return runtime.Allocator{
+ procedure = heap_allocator_proc,
+ data = nil,
+ }
+}
+
+
+@(require_results)
+heap_allocator_proc :: proc(allocator_data: rawptr, mode: runtime.Allocator_Mode,
+ size, alignment: int,
+ old_memory: rawptr, old_size: int, loc := #caller_location) -> ([]byte, runtime.Allocator_Error) {
+ return _heap_allocator_proc(allocator_data, mode, size, alignment, old_memory, old_size, loc)
+}