default_allocators_general.odin 480 B

1234567891011121314151617181920212223
  1. //+build !windows
  2. //+build !freestanding
  3. //+build !wasi
  4. //+build !js
  5. package runtime
  6. // TODO(bill): reimplement these procedures in the os_specific stuff
  7. import "core:os"
  8. when ODIN_DEFAULT_TO_NIL_ALLOCATOR {
  9. _ :: os
  10. // mem.nil_allocator reimplementation
  11. default_allocator_proc :: nil_allocator_proc
  12. default_allocator :: nil_allocator
  13. } else {
  14. default_allocator_proc :: os.heap_allocator_proc
  15. default_allocator :: proc() -> Allocator {
  16. return os.heap_allocator()
  17. }
  18. }