History log of /bionic/tests/malloc_test.cpp
Revision Date Author Comments
39b952cf0a824db1cdc301dd048db0e56d4d5c24 12-Feb-2016 Christopher Ferris <cferris@google.com> 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
535c5992d6692124357247a70a37772fae1a8569 11-Feb-2016 Elliott Hughes <enh@google.com> Add tests for zero-sized allocations.

POSIX lets us return null and set errno, but that would be annoying and
surprising.

Bug: http://b/27101951

(cherry picked from commit 884f76e3aa081740f7cfe582b11af7446bf77bd9)

Change-Id: Ice4fd3cd427523edc2ca4ba25caf9701c353db47
ad33ebead801f24d3197bc16f875501729e98485 16-Dec-2015 Christopher Ferris <cferris@google.com> Fix bug in dlmalloc's version of calloc.

Under some circumstances, doing a calloc will make sure that the memory
returned will be zero up to the size of the requested size. However, if
there is more usable size than the requested size, that extra part
of the allocation will not be zeroed. This change fixes it so that the
entire usable memory is always zeroed.

Change-Id: I8a66d6767c074023c4ba3568bf2705e1886740fc
4caa1f09770ea3e5ca22afbe8aa0900810a0dbfe 20-Aug-2014 Dan Albert <danalbert@google.com> Implement malloc_info(3).

Expose jemalloc stats through the malloc_info(3) interface.

Bug: 16874689
Change-Id: I4358ac283002e60ff161107028d1a3fb1e9afb0a
636196438180fd37027bf7b7119a436169b6923e 17-Jun-2014 Christopher Ferris <cferris@google.com> Use a separate config.h for config like defines.

This allows an easier way to share config parameters between unit tests
and the bionic code.

It also fixes a problem where the 32 bit bionic tests based on glibc, or
the cts list executable did not have the pvalloc,valloc tests.

Change-Id: Ib47942cb8a278252faa7498a6ef23e9578db544f
a403780538ac9d1a260e064df6599663f8cc4166 10-Jun-2014 Christopher Ferris <cferris@google.com> Put all allocation functions into dispatch table.

Implement these new functions for all of the debug malloc types.

Fix a number of bugs in the debug malloc functions related to overflow
conditions.
Fix a bug in dlpvalloc due to an overflow condition.

Fix various other bugs in the debug malloc functions.

Add new tests for malloc functions.

Bug: 11225066

Change-Id: Idf50f389603e2157645565bc15cd9365eec2e9dd
e5fdaa4f9d102461a4d8a865e6ca84666893b9e7 14-Jun-2014 Dan Albert <danalbert@google.com> Revert "Backing this one out since the counterpart needs to be sent upstream."

This reverts commit a04d2bc28e7d7fcaf34ad71e4a6608a13cf84197.

Change-Id: I1b49165ca5d4bafdba7948818256a6167a363aca
a04d2bc28e7d7fcaf34ad71e4a6608a13cf84197 14-Jun-2014 Dan Albert <danalbert@google.com> Backing this one out since the counterpart needs to be sent upstream.

This reverts commit 5ee320dd35fafc11eaf90c62198e08c6670e35b4.

Change-Id: I1a9c6b06c3aca595f01c629f7649be743dc48e77
5ee320dd35fafc11eaf90c62198e08c6670e35b4 12-Jun-2014 Dan Albert <danalbert@google.com> Hides valloc(3)/pvalloc(3) on LP64.

These were removed from POSIX 2004. Hides the header declarations for all
targets, and hides the symbols for LP64.

Bug: 13935372
Change-Id: Id592f67e9b7051517a05f536e1373b30162e669c
72bbd423579bb971dc06cdd3c06201faf3fe95e6 08-May-2014 Christopher Ferris <cferris@google.com> Support for jemalloc to replace dlmalloc.

To use jemalloc, add MALLOC_IMPL = jemalloc in a board config file
and you get the new version automatically.

Update the pthread_create_key tests since jemalloc uses a few keys.
Add a new test to verify memalign works as expected.

Bug: 981363

Change-Id: I16eb152b291a95bd2499e90492fc6b4bd7053836
885f3b9cad01b8158aadc55c159c17dbf34f622c 22-May-2013 Christopher Ferris <cferris@google.com> Implement malloc_usable_size for debug impls.

- Implemented chk_memalign.
- Fixed a few bugs in leak_memalign.
- Implemented {leak,fill,check,qemu}_malloc_usable_size.
- Make malloc_usable_size update at run time.
- Add malloc_test.cpp as a small set of tests for the
malloc debug routines.
- Fix the qemu routines since it's been broken since it moved to C++.
- Add support for the %u format to the out_vformat in libc_logging.cpp.
This is used by the emulator code.

Tested using the bionic-unit-tests with setprop libc.debug.malloc
set to 1, 5, and 10.

I tested as much as possible on the emulator, but tracing doesn't appear
to be working properly.

Bug: 6143477

Merge change from internal master.

(cherry-picked from commit 3d594c258045783fc9e1956ce7a4d91e302f011e)

Change-Id: I4ae00fffba82315a8c283f35893fd554460722fb
3d594c258045783fc9e1956ce7a4d91e302f011e 22-May-2013 Christopher Ferris <cferris@google.com> Implement malloc_usable_size for debug impls.

- Implemented chk_memalign.
- Fixed a few bugs in leak_memalign.
- Implemented {leak,fill,check,qemu}_malloc_usable_size.
- Make malloc_usable_size update at run time.
- Add malloc_test.cpp as a small set of tests for the
malloc debug routines.
- Fix the qemu routines since it's been broken since it moved to C++.
- Add support for the %u format to the out_vformat in libc_logging.cpp.
This is used by the emulator code.

Tested using the bionic-unit-tests with setprop libc.debug.malloc
set to 1, 5, and 10.

I tested as much as possible on the emulator, but tracing doesn't appear
to be working properly.

Bug: 6143477

Change-Id: Ieba99b58c2228c88d80afd264501004a4dadd212