OLD | NEW |
1 // Copyright (c) 2011, Google Inc. | 1 // Copyright (c) 2011, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 22 matching lines...) Expand all Loading... |
33 // Used to override malloc routines on systems that are using glibc. | 33 // Used to override malloc routines on systems that are using glibc. |
34 | 34 |
35 #ifndef TCMALLOC_LIBC_OVERRIDE_GLIBC_INL_H_ | 35 #ifndef TCMALLOC_LIBC_OVERRIDE_GLIBC_INL_H_ |
36 #define TCMALLOC_LIBC_OVERRIDE_GLIBC_INL_H_ | 36 #define TCMALLOC_LIBC_OVERRIDE_GLIBC_INL_H_ |
37 | 37 |
38 #include <config.h> | 38 #include <config.h> |
39 #include <features.h> // for __GLIBC__ | 39 #include <features.h> // for __GLIBC__ |
40 #ifdef HAVE_SYS_CDEFS_H | 40 #ifdef HAVE_SYS_CDEFS_H |
41 #include <sys/cdefs.h> // for __THROW | 41 #include <sys/cdefs.h> // for __THROW |
42 #endif | 42 #endif |
43 #include <google/tcmalloc.h> | 43 #include <gperftools/tcmalloc.h> |
44 | 44 |
45 #ifndef __GLIBC__ | 45 #ifndef __GLIBC__ |
46 # error libc_override_glibc.h is for glibc distributions only. | 46 # error libc_override_glibc.h is for glibc distributions only. |
47 #endif | 47 #endif |
48 | 48 |
49 // In glibc, the memory-allocation methods are weak symbols, so we can | 49 // In glibc, the memory-allocation methods are weak symbols, so we can |
50 // just override them with our own. If we're using gcc, we can use | 50 // just override them with our own. If we're using gcc, we can use |
51 // __attribute__((alias)) to do the overriding easily (exception: | 51 // __attribute__((alias)) to do the overriding easily (exception: |
52 // Mach-O, which doesn't support aliases). Otherwise we have to use a | 52 // Mach-O, which doesn't support aliases). Otherwise we have to use a |
53 // function call. | 53 // function call. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 = &glibc_override_free; | 139 = &glibc_override_free; |
140 void* (* MALLOC_HOOK_MAYBE_VOLATILE __memalign_hook)(size_t,size_t, const void*) | 140 void* (* MALLOC_HOOK_MAYBE_VOLATILE __memalign_hook)(size_t,size_t, const void*) |
141 = &glibc_override_memalign; | 141 = &glibc_override_memalign; |
142 | 142 |
143 } // extern "C" | 143 } // extern "C" |
144 | 144 |
145 // No need to write ReplaceSystemAlloc(); one of the #includes above | 145 // No need to write ReplaceSystemAlloc(); one of the #includes above |
146 // did it for us. | 146 // did it for us. |
147 | 147 |
148 #endif // TCMALLOC_LIBC_OVERRIDE_GLIBC_INL_H_ | 148 #endif // TCMALLOC_LIBC_OVERRIDE_GLIBC_INL_H_ |
OLD | NEW |