| OLD | NEW |
| 1 /* Copyright (c) 2003, Google Inc. | 1 /* Copyright (c) 2003, 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 * | 29 * |
| 30 * --- | 30 * --- |
| 31 * Author: Sanjay Ghemawat <opensource@google.com> | 31 * Author: Sanjay Ghemawat <opensource@google.com> |
| 32 * .h file by Craig Silverstein <opensource@google.com> | 32 * .h file by Craig Silverstein <opensource@google.com> |
| 33 */ | 33 */ |
| 34 | 34 |
| 35 #ifndef TCMALLOC_TCMALLOC_H_ | 35 #ifndef TCMALLOC_TCMALLOC_H_ |
| 36 #define TCMALLOC_TCMALLOC_H_ | 36 #define TCMALLOC_TCMALLOC_H_ |
| 37 | 37 |
| 38 // Define the version number so folks can check against it | |
| 39 #define TC_VERSION_MAJOR 1 | |
| 40 #define TC_VERSION_MINOR 4 | |
| 41 #define TC_VERSION_PATCH "" | |
| 42 #define TC_VERSION_STRING "google-perftools 1.4" | |
| 43 | |
| 44 // __THROW is defined in glibc systems. It means, counter-intuitively, | 38 // __THROW is defined in glibc systems. It means, counter-intuitively, |
| 45 // "This function will never throw an exception." It's an optional | 39 // "This function will never throw an exception." It's an optional |
| 46 // optimization tool, but we may need to use it to match glibc prototypes. | 40 // optimization tool, but we may need to use it to match glibc prototypes. |
| 47 #ifndef __THROW /* I guess we're not on a glibc system */ | 41 #ifndef __THROW /* I guess we're not on a glibc system */ |
| 48 # define __THROW /* __THROW is just an optimization, so ok to make it "" */ | 42 # define __THROW /* __THROW is just an optimization, so ok to make it "" */ |
| 49 #endif | 43 #endif |
| 50 | 44 |
| 45 // Define the version number so folks can check against it |
| 46 #define TC_VERSION_MAJOR 1 |
| 47 #define TC_VERSION_MINOR 7 |
| 48 #define TC_VERSION_PATCH "" |
| 49 #define TC_VERSION_STRING "google-perftools 1.7" |
| 51 | 50 |
| 52 #include <stdlib.h> // for struct mallinfo, if it's defined | 51 #include <stdlib.h> // for struct mallinfo, if it's defined |
| 53 | 52 |
| 54 // Annoying stuff for windows -- makes sure clients can import these functions | 53 // Annoying stuff for windows -- makes sure clients can import these functions |
| 55 #ifndef PERFTOOLS_DLL_DECL | 54 #ifndef PERFTOOLS_DLL_DECL |
| 56 # ifdef _WIN32 | 55 # ifdef _WIN32 |
| 57 # define PERFTOOLS_DLL_DECL __declspec(dllimport) | 56 # define PERFTOOLS_DLL_DECL __declspec(dllimport) |
| 58 # else | 57 # else |
| 59 # define PERFTOOLS_DLL_DECL | 58 # define PERFTOOLS_DLL_DECL |
| 60 # endif | 59 # endif |
| (...skipping 22 matching lines...) Expand all Loading... |
| 83 size_t align, size_t size) __THROW; | 82 size_t align, size_t size) __THROW; |
| 84 PERFTOOLS_DLL_DECL void* tc_valloc(size_t __size) __THROW; | 83 PERFTOOLS_DLL_DECL void* tc_valloc(size_t __size) __THROW; |
| 85 PERFTOOLS_DLL_DECL void* tc_pvalloc(size_t __size) __THROW; | 84 PERFTOOLS_DLL_DECL void* tc_pvalloc(size_t __size) __THROW; |
| 86 | 85 |
| 87 PERFTOOLS_DLL_DECL void tc_malloc_stats(void) __THROW; | 86 PERFTOOLS_DLL_DECL void tc_malloc_stats(void) __THROW; |
| 88 PERFTOOLS_DLL_DECL int tc_mallopt(int cmd, int value) __THROW; | 87 PERFTOOLS_DLL_DECL int tc_mallopt(int cmd, int value) __THROW; |
| 89 #if 0 | 88 #if 0 |
| 90 PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) __THROW; | 89 PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) __THROW; |
| 91 #endif | 90 #endif |
| 92 | 91 |
| 92 // This is an alias for MallocExtension::instance()->GetAllocatedSize(). |
| 93 // It is equivalent to |
| 94 // OS X: malloc_size() |
| 95 // glibc: malloc_usable_size() |
| 96 // Windows: _msize() |
| 97 PERFTOOLS_DLL_DECL size_t tc_malloc_size(void* ptr) __THROW; |
| 98 |
| 93 #ifdef __cplusplus | 99 #ifdef __cplusplus |
| 94 PERFTOOLS_DLL_DECL int tc_set_new_mode(int flag) __THROW; | 100 PERFTOOLS_DLL_DECL int tc_set_new_mode(int flag) __THROW; |
| 95 PERFTOOLS_DLL_DECL void* tc_new(size_t size); | 101 PERFTOOLS_DLL_DECL void* tc_new(size_t size); |
| 96 PERFTOOLS_DLL_DECL void* tc_new_nothrow(size_t size, | 102 PERFTOOLS_DLL_DECL void* tc_new_nothrow(size_t size, |
| 97 const std::nothrow_t&) __THROW; | 103 const std::nothrow_t&) __THROW; |
| 98 PERFTOOLS_DLL_DECL void tc_delete(void* p) __THROW; | 104 PERFTOOLS_DLL_DECL void tc_delete(void* p) __THROW; |
| 99 PERFTOOLS_DLL_DECL void tc_delete_nothrow(void* p, | 105 PERFTOOLS_DLL_DECL void tc_delete_nothrow(void* p, |
| 100 const std::nothrow_t&) __THROW; | 106 const std::nothrow_t&) __THROW; |
| 101 PERFTOOLS_DLL_DECL void* tc_newarray(size_t size); | 107 PERFTOOLS_DLL_DECL void* tc_newarray(size_t size); |
| 102 PERFTOOLS_DLL_DECL void* tc_newarray_nothrow(size_t size, | 108 PERFTOOLS_DLL_DECL void* tc_newarray_nothrow(size_t size, |
| 103 const std::nothrow_t&) __THROW; | 109 const std::nothrow_t&) __THROW; |
| 104 PERFTOOLS_DLL_DECL void tc_deletearray(void* p) __THROW; | 110 PERFTOOLS_DLL_DECL void tc_deletearray(void* p) __THROW; |
| 105 PERFTOOLS_DLL_DECL void tc_deletearray_nothrow(void* p, | 111 PERFTOOLS_DLL_DECL void tc_deletearray_nothrow(void* p, |
| 106 const std::nothrow_t&) __THROW; | 112 const std::nothrow_t&) __THROW; |
| 107 } | 113 } |
| 108 #endif | 114 #endif |
| 109 | 115 |
| 110 #endif // #ifndef TCMALLOC_TCMALLOC_H_ | 116 #endif // #ifndef TCMALLOC_TCMALLOC_H_ |
| OLD | NEW |