diff options
| -rw-r--r-- | base/runtime/core_builtin.odin | 1 | ||||
| -rw-r--r-- | base/runtime/core_builtin_soa.odin | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/base/runtime/core_builtin.odin b/base/runtime/core_builtin.odin index 3692751bb..f576adcc2 100644 --- a/base/runtime/core_builtin.odin +++ b/base/runtime/core_builtin.odin @@ -312,6 +312,7 @@ make_dynamic_array_len :: proc($T: typeid/[dynamic]$E, #any_int len: int, alloca @(builtin, require_results) make_dynamic_array_len_cap :: proc($T: typeid/[dynamic]$E, #any_int len: int, #any_int cap: int, allocator := context.allocator, loc := #caller_location) -> (array: T, err: Allocator_Error) #optional_allocator_error { make_dynamic_array_error_loc(loc, len, cap) + array.allocator = allocator // initialize allocator before just in case it fails to allocate any memory data := mem_alloc_bytes(size_of(E)*cap, align_of(E), allocator, loc) or_return s := Raw_Dynamic_Array{raw_data(data), len, cap, allocator} if data == nil && size_of(E) != 0 { diff --git a/base/runtime/core_builtin_soa.odin b/base/runtime/core_builtin_soa.odin index 94f5be1d4..1b2e5d316 100644 --- a/base/runtime/core_builtin_soa.odin +++ b/base/runtime/core_builtin_soa.odin @@ -86,6 +86,7 @@ make_soa_aligned :: proc($T: typeid/#soa[]$E, length: int, alignment: int, alloc return } + array.allocator = allocator footer := raw_soa_footer(&array) if size_of(E) == 0 { footer.len = length |