summaryrefslogtreecommitdiffstats
path: root/libc/upstream-dlmalloc
Commit message (Collapse)AuthorAgeFilesLines
* Return total footprint, not high water mark.Christopher Ferris2014-10-131-1/+3
| | | | | | | | | | The mallinfo usmblks value returned by dlmalloc is a little misleading. It's not the current max, it's the historical high water mark. This leads to dumpsys meminfo producing native memory numbers that don't add up. Change this to the real total footprint, not this high water mark. Bug: 17265653 Change-Id: Id0293a1b50c9b0be8795405049f537a51ab0e8b7
* Put all allocation functions into dispatch table.Christopher Ferris2014-06-121-1/+8
| | | | | | | | | | | | | | | | 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
* Fix build warning of initialization but no use.Ian Rogers2012-09-061-2/+2
| | | | | | | | first_run is only used with LOCK_AT_FORK, however, care needs to be taken with the #if to avoid compiler warnings when LOCK_AT_FORK isn't being used. Change-Id: I6bcfac2ab8732c91607f4a1bcd7c0019f29c2eec
* Merge "Avoid malloc lock while calling pthread_atfork."Ian Rogers2012-09-051-1/+16
|\
| * Avoid malloc lock while calling pthread_atfork.Kirill Artamonov2012-08-311-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expecting the memory in a forked child process to be sane wrt threading is a bad idea. An example of a problem is when the parent process has the malloc lock and a child process is forked. The malloc lock in the child will appear locked by a thread that doesn't exist. This change aims to make bionic more compatible with glibc by reseting the malloc lock in the child forked process, as well as holding it during the fork. This is a feature in dlmalloc 2.8.6 called LOCK_AT_FORK. In general this feature isn't necessary as a forked process will then exec. Some bad applications rely on being able to use features like malloc before the exec and having multiple threads running in the parent program. This isn't a problem with glibc and this patch makes it not a problem for bionic. Unfortunately for use in bionic, LOCK_AT_FORK has an issue as internally it uses pthread_atfork that in bionic uses malloc. This leads to the LOCK_AT_FORK initialization deadlocking with pthread_atfork's call to malloc due to the malloc lock. This change moves the pthread_atfork logic in LOCK_AT_FORK to be called without the malloc lock held. Change-Id: Id68175a564a6abb936ee4488b44d9479f7311f69
* | Add missing MALLOC_FAILURE_ACTION calls to dlmalloc.Elliott Hughes2012-09-041-2/+10
|/ | | | | | Without these, sometimes malloc(3) returns NULL without setting errno. Change-Id: I4708c3f675bf2c878ddcaf012fde7848b255826b
* Upgrade to dlmalloc 2.8.6.Ian Rogers2012-08-293-69/+81
| | | | | | This fixes a bug and enables the use of MORECORE_CONTIGUOUS. Change-Id: Ia7c5d32bdc46e99b3ecb92ee94d1f702c4385d5d
* Upgrade to dlmalloc 2.8.5.Ian Rogers2012-08-203-0/+6904
Move dlmalloc code to upstream-dlmalloc to make pulling upstream changes easier. Declare pvalloc and malloc_usable_size routines present in malloc.h but with missing implementations. Remove other functions from malloc.h that have no implementation nor use in Android. Change-Id: Ia6472ec6cbebc9ad1ef99f4669de9d33fcc2efb4