mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
add zeroing regardless of ODIN_OS
This commit is contained in:
+5
-6
@@ -212,12 +212,11 @@ heap_allocator_proc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
new_memory = aligned_alloc(new_size, new_alignment, p) or_return
|
new_memory = aligned_alloc(new_size, new_alignment, p) or_return
|
||||||
when ODIN_OS != "windows" {
|
|
||||||
// NOTE: realloc does not zero the new memory, so we do it
|
// NOTE: heap_resize does not zero the new memory, so we do it
|
||||||
if new_size > old_size {
|
if new_size > old_size {
|
||||||
new_region := mem.raw_data(new_memory[old_size:])
|
new_region := mem.raw_data(new_memory[old_size:])
|
||||||
mem.zero(new_region, new_size - old_size)
|
mem.zero(new_region, new_size - old_size)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user