summaryrefslogtreecommitdiff
path: root/libc/malloc_hooks/malloc_hooks.cpp
AgeCommit message (Collapse)Author
2019-11-08Rename iterate to malloc_iterate internally.Christopher Ferris
I have no idea why I used the iterate name internally which is completely unlike every other function name. Change this to match everyone else so that it's now malloc_iterate everywhere. This is probably the last chance to change this before mainline modules begin, so make everything consistent. Test: Compiles, unit tests passes. Change-Id: I56d293377fa0fe1a3dc3dd85d6432f877cc2003c
2019-04-16Remove gMallocLeakZygoteChild.Christopher Ferris
Remove this global variable and change the setting of it to non-zero to a call to android_mallopt. In addition, change the initialize function to use pass a bool* instead of int*. Bug: 130028357 Test: Ran malloc_debug/malloc_hooks/perfetto tests. Change-Id: I20d382bdeaaf38aac6b9dcabea5b3dfab3c945f6 Merged-In: I20d382bdeaaf38aac6b9dcabea5b3dfab3c945f6 (cherry picked from commit 5225b342f0810c027df3d09fbbcef4d324b19b93)
2019-03-07Refactor the malloc_info code.Christopher Ferris
malloc_info needs to be per native allocator, but the code treated it like a global function that doesn't depend on the native memory allocator. Update malloc debug to dump the actual pointers that it has been tracking. Test: bionic-unit-tests pass. Test: malloc debug tests pass. Test: malloc hook tests pass. Change-Id: I3b0d4d748489dd84c16d16933479dc8b8d79013e Merged-In: I3b0d4d748489dd84c16d16933479dc8b8d79013e (cherry picked from commit a3656a98b10d2a4a6194a5d9705ad9c2cc5877b0)
2019-03-01Make aligned_alloc match the standard.Christopher Ferris
Jemalloc does not verify that the size parameter is a multiple of alignment. Fix this since it only went into P. Fix the unit tests, and fix malloc debug/malloc hooks to handle this new restrictive behavior. Bug: 126944692 Test: Ran bionic unit tests. Test: Ran bionic unit tests with malloc hooks enabled (no new tests fail). Test: Ran bionic unit tests with malloc debug enabled (no new tests fail). Test: Ran malloc debug unit tests. Change-Id: I4d50785928815679c781ca729f998454d76b9192
2018-07-18Fix malloc_hooks for hooks_write_malloc_leak_info.Florian Mayer
Change-Id: I99f9ee0221bc7bbb5e7dd173ae5a6007f0fa871d
2018-02-13Implement malloc hooks.Christopher Ferris
Use the malloc debug framework to implement the malloc debug hooks since it can introduce a performance issue. Also, modify the bionic/tests/utils.h slightly to dump an error message when the exe failed. Bug: 30561479 Test: Ran malloc hook unit tests. Test: Ran malloc debug unit tests. Test: Enabled malloc hooks and ran bionic unit tests and verified no Test: unexpected failures. Test: Enabled malloc debug and malloc hooks and verified malloc debug wins. Test: Enabled malloc debug using env, property, and property with name Test: still works. Change-Id: Ib50046a0493c5c2050cf831befb812310bdcc249 (cherry picked from commit d6a1dc23796696f73f483943534d4c5c4b312d39)