OLD | NEW |
(Empty) | |
| 1 /* Copyright (c) 2003, Google Inc. |
| 2 * All rights reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are |
| 6 * met: |
| 7 * |
| 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 * |
| 30 * --- |
| 31 * Author: Sanjay Ghemawat <opensource@google.com> |
| 32 * .h file by Craig Silverstein <opensource@google.com> |
| 33 */ |
| 34 |
| 35 #ifndef TCMALLOC_TCMALLOC_H_ |
| 36 #define TCMALLOC_TCMALLOC_H_ |
| 37 |
| 38 // __THROW is defined in glibc systems. It means, counter-intuitively, |
| 39 // "This function will never throw an exception." It's an optional |
| 40 // optimization tool, but we may need to use it to match glibc prototypes. |
| 41 #ifndef __THROW /* I guess we're not on a glibc system */ |
| 42 # define __THROW /* __THROW is just an optimization, so ok to make it "" */ |
| 43 #endif |
| 44 |
| 45 #include <stdlib.h> // for struct mallinfo, if it's defined |
| 46 |
| 47 #ifdef __cplusplus |
| 48 #include <new> // for nothrow_t |
| 49 extern "C" { |
| 50 #endif |
| 51 void* tc_malloc(size_t size) __THROW; |
| 52 void tc_free(void* ptr) __THROW; |
| 53 void* tc_realloc(void* ptr, size_t size) __THROW; |
| 54 void* tc_calloc(size_t nmemb, size_t size) __THROW; |
| 55 void tc_cfree(void* ptr) __THROW; |
| 56 |
| 57 void* tc_memalign(size_t __alignment, size_t __size) __THROW; |
| 58 int tc_posix_memalign(void** ptr, size_t align, size_t size) __THROW; |
| 59 void* tc_valloc(size_t __size) __THROW; |
| 60 void* tc_pvalloc(size_t __size) __THROW; |
| 61 |
| 62 void tc_malloc_stats(void) __THROW; |
| 63 int tc_mallopt(int cmd, int value) __THROW; |
| 64 // TODO(willchan): Fork this for Linux/Windows if we need this on Linux. |
| 65 #if 0 |
| 66 struct mallinfo tc_mallinfo(void) __THROW; |
| 67 #endif |
| 68 |
| 69 #ifdef __cplusplus |
| 70 void* tc_new(size_t size); |
| 71 void tc_delete(void* p) __THROW; |
| 72 void* tc_newarray(size_t size); |
| 73 void tc_deletearray(void* p) __THROW; |
| 74 |
| 75 void* tc_new_nothrow(size_t size, const std::nothrow_t&) __THROW; |
| 76 void* tc_newarray_nothrow(size_t size, const std::nothrow_t&) __THROW; |
| 77 } |
| 78 #endif |
| 79 |
| 80 #endif // #ifndef TCMALLOC_TCMALLOC_H_ |
OLD | NEW |