OSDN Git Service

Fix the default alignment of the allocations.
authorChristopher Ferris <cferris@google.com>
Thu, 11 Feb 2016 23:51:31 +0000 (15:51 -0800)
committerChristopher Ferris <cferris@google.com>
Sat, 13 Feb 2016 01:50:48 +0000 (17:50 -0800)
commit39b952cf0a824db1cdc301dd048db0e56d4d5c24
treed45b803894e7344a830d4a538f82b73f2e0fe6bc
parent66c25c360afb161be02fbdb8da21cd02c9d99447
Fix the default alignment of the allocations.

In order to enforce this constraint:

The pointer returned if the allocation succeeds shall be suitably
aligned so that it may be assigned to a pointer to any type of object
and then used to access such an object in the space allocated.

Force all allocations on 32 bit systems to have 8 byte alignment,
and all allocations on 64 bit systems to have 16 byte alignment.

Add a test to verify that the allocator returns the correct alignments.

Bug: 26739265

(cherry picked from commit 72df6708c829a4c6494936fdfbda6dc7e68e647b)

Change-Id: I44ca8bedb1dac375087da1af3a1d7d12034e037f
libc/malloc_debug/BacktraceData.cpp
libc/malloc_debug/Config.cpp
libc/malloc_debug/Config.h
libc/malloc_debug/DebugData.cpp
libc/malloc_debug/GuardData.cpp
libc/malloc_debug/malloc_debug.cpp
libc/malloc_debug/malloc_debug.h
libc/malloc_debug/tests/malloc_debug_config_tests.cpp
libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
tests/malloc_test.cpp