diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2021-03-15 11:47:48 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-15 11:47:48 +0000 |
| commit | 85fd8aaf37c505c7ed48160d181a2106d9ef3eff (patch) | |
| tree | 6f13778883f7ade0436c24a932801a4fdef8ed7e | |
| parent | 6412a18ae160d35a087f7c2af56e581f326799f8 (diff) | |
| parent | 0d1addf0d41e89d9f30ee70772df0938c7880a71 (diff) | |
Merge pull request #868 from nakst/patch-1
Make size of allocation multiple of the alignment
| -rw-r--r-- | src/gb/gb.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gb/gb.h b/src/gb/gb.h index 687227dd3..b56c20f1e 100644 --- a/src/gb/gb.h +++ b/src/gb/gb.h @@ -5026,7 +5026,7 @@ GB_ALLOCATOR_PROC(gb_heap_allocator_proc) { #elif defined(GB_SYSTEM_LINUX) // TODO(bill): *nix version that's decent case gbAllocation_Alloc: { - ptr = aligned_alloc(alignment, size); + ptr = aligned_alloc(alignment, (size + alignment - 1) & ~(alignment - 1)); // ptr = malloc(size+alignment); if (flags & gbAllocatorFlag_ClearToZero) { |