aboutsummaryrefslogtreecommitdiff
path: root/core/os/heap.odin
blob: 356e60b4d65628327cea0cc5dd6fd4b3c0cbc813 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)
}