aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCiD- <jkercher43@gmail.com>2021-12-17 12:04:05 -0500
committerCiD- <jkercher43@gmail.com>2021-12-17 12:04:05 -0500
commitebdb3ab43a8cdc49cb715ecb6f5fd38522912aa5 (patch)
treed460f190ca45663a1211cf320edb82fbed77d0dc
parent29ca6ee420f36381ee0fba6bd409dc51716ab206 (diff)
added notes about _unix_alloc
-rw-r--r--core/os/os_darwin.odin2
-rw-r--r--core/os/os_freebsd.odin2
-rw-r--r--core/os/os_linux.odin2
3 files changed, 6 insertions, 0 deletions
diff --git a/core/os/os_darwin.odin b/core/os/os_darwin.odin
index d40c80aeb..6fa43bf09 100644
--- a/core/os/os_darwin.odin
+++ b/core/os/os_darwin.odin
@@ -530,6 +530,8 @@ heap_alloc :: proc(size: int) -> rawptr {
return _unix_calloc(1, size)
}
heap_resize :: proc(ptr: rawptr, new_size: int) -> rawptr {
+ // NOTE: _unix_realloc doesn't guarantee new memory will be zeroed on
+ // POSIX platforms. Ensure your caller takes this into account.
return _unix_realloc(ptr, new_size)
}
heap_free :: proc(ptr: rawptr) {
diff --git a/core/os/os_freebsd.odin b/core/os/os_freebsd.odin
index e9314b468..82317532d 100644
--- a/core/os/os_freebsd.odin
+++ b/core/os/os_freebsd.odin
@@ -378,6 +378,8 @@ heap_alloc :: proc(size: int) -> rawptr {
}
heap_resize :: proc(ptr: rawptr, new_size: int) -> rawptr {
+ // NOTE: _unix_realloc doesn't guarantee new memory will be zeroed on
+ // POSIX platforms. Ensure your caller takes this into account.
return _unix_realloc(ptr, c.size_t(new_size));
}
diff --git a/core/os/os_linux.odin b/core/os/os_linux.odin
index 260a051ce..116fbdba5 100644
--- a/core/os/os_linux.odin
+++ b/core/os/os_linux.odin
@@ -543,6 +543,8 @@ heap_alloc :: proc(size: int) -> rawptr {
}
heap_resize :: proc(ptr: rawptr, new_size: int) -> rawptr {
+ // NOTE: _unix_realloc doesn't guarantee new memory will be zeroed on
+ // POSIX platforms. Ensure your caller takes this into account.
return _unix_realloc(ptr, c.size_t(new_size))
}