| The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | /* | 
| Ian Rogers | 9990891 | 2012-08-17 17:28:15 -0700 | [diff] [blame] | 2 | * Copyright (C) 2012 The Android Open Source Project | 
|  | 3 | * | 
|  | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | * you may not use this file except in compliance with the License. | 
|  | 6 | * You may obtain a copy of the License at | 
|  | 7 | * | 
|  | 8 | *      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | * | 
|  | 10 | * Unless required by applicable law or agreed to in writing, software | 
|  | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | * See the License for the specific language governing permissions and | 
|  | 14 | * limitations under the License. | 
| The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 15 | */ | 
| The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 16 |  | 
| Ian Rogers | 9990891 | 2012-08-17 17:28:15 -0700 | [diff] [blame] | 17 | #ifndef LIBC_BIONIC_DLMALLOC_H_ | 
|  | 18 | #define LIBC_BIONIC_DLMALLOC_H_ | 
| The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 19 |  | 
| Elliott Hughes | 9b5235d | 2014-06-03 18:47:17 -0700 | [diff] [blame] | 20 | #include <sys/cdefs.h> | 
|  | 21 | #include <stddef.h> | 
|  | 22 |  | 
| Ian Rogers | 9990891 | 2012-08-17 17:28:15 -0700 | [diff] [blame] | 23 | /* Configure dlmalloc. */ | 
|  | 24 | #define HAVE_GETPAGESIZE 1 | 
|  | 25 | #define MALLOC_INSPECT_ALL 1 | 
| Ian Rogers | 9990891 | 2012-08-17 17:28:15 -0700 | [diff] [blame] | 26 | #define MSPACES 0 | 
|  | 27 | #define REALLOC_ZERO_BYTES_FREES 1 | 
|  | 28 | #define USE_DL_PREFIX 1 | 
|  | 29 | #define USE_LOCKS 1 | 
| Kirill Artamonov | 3e2d293 | 2012-08-31 09:19:16 -0700 | [diff] [blame] | 30 | #define LOCK_AT_FORK 1 | 
| Ian Rogers | 9990891 | 2012-08-17 17:28:15 -0700 | [diff] [blame] | 31 | #define USE_RECURSIVE_LOCK 0 | 
|  | 32 | #define USE_SPIN_LOCKS 0 | 
| Rom Lemarchand | d0f2a60 | 2013-07-23 11:30:52 -0700 | [diff] [blame] | 33 | #define DEFAULT_MMAP_THRESHOLD (64U * 1024U) | 
| The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 34 |  | 
| Elliott Hughes | 91570ce | 2014-07-10 12:34:23 -0700 | [diff] [blame] | 35 | #define malloc_getpagesize getpagesize() | 
|  | 36 |  | 
| Christopher Ferris | f903558 | 2014-09-05 16:39:22 -0700 | [diff] [blame] | 37 | #if !defined(__LP64__) | 
| Christopher Ferris | f183f95 | 2014-10-08 22:48:20 -0700 | [diff] [blame] | 38 | /* dlmalloc_usable_size and dlmalloc were exposed in the NDK and some | 
|  | 39 | * apps actually used them. Rename these functions out of the way | 
|  | 40 | * for 32 bit architectures so that ndk_cruft.cpp can expose | 
|  | 41 | * compatibility shims with these names. | 
|  | 42 | */ | 
| Christopher Ferris | f903558 | 2014-09-05 16:39:22 -0700 | [diff] [blame] | 43 | #define dlmalloc_usable_size dlmalloc_usable_size_real | 
| Christopher Ferris | f183f95 | 2014-10-08 22:48:20 -0700 | [diff] [blame] | 44 | #define dlmalloc dlmalloc_real | 
| Christopher Ferris | f903558 | 2014-09-05 16:39:22 -0700 | [diff] [blame] | 45 | #endif | 
|  | 46 |  | 
| Christopher Ferris | f9554a1 | 2015-06-05 17:12:17 -0700 | [diff] [blame] | 47 | /* These two symbols are exported on devices that use dlmalloc. | 
|  | 48 | * In order to be consistent across all devices, they will | 
|  | 49 | * be exported everywhere. Move the real symbols out of the way | 
|  | 50 | * so that ndk_cruft.cpp can export these symbols. | 
|  | 51 | */ | 
|  | 52 | #define dlmalloc_inspect_all dlmalloc_inspect_all_real | 
|  | 53 | #define dlmalloc_trim dlmalloc_trim_real | 
| Elliott Hughes | 9b5235d | 2014-06-03 18:47:17 -0700 | [diff] [blame] | 54 |  | 
| Ian Rogers | 9990891 | 2012-08-17 17:28:15 -0700 | [diff] [blame] | 55 | /* Include the proper definitions. */ | 
|  | 56 | #include "../upstream-dlmalloc/malloc.h" | 
| The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 57 |  | 
| Ian Rogers | 9990891 | 2012-08-17 17:28:15 -0700 | [diff] [blame] | 58 | #endif  // LIBC_BIONIC_DLMALLOC_H_ |