~ubuntu-branches/ubuntu/wily/google-perftools/wily

« back to all changes in this revision

Viewing changes to src/windows/google/tcmalloc.h

  • Committer: Bazaar Package Importer
  • Author(s): Daigo Moriwaki
  • Date: 2009-09-19 00:10:06 UTC
  • mto: (3.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20090919001006-m997dckgoqs3sru9
Tags: upstream-1.4
ImportĀ upstreamĀ versionĀ 1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
// Define the version number so folks can check against it
 
39
#define TC_VERSION_MAJOR  1
 
40
#define TC_VERSION_MINOR  3
 
41
#define TC_VERSION_PATCH  ""
 
42
#define TC_VERSION_STRING "google-perftools 1.3"
 
43
 
 
44
// __THROW is defined in glibc systems.  It means, counter-intuitively,
 
45
// "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.
 
47
#ifndef __THROW    /* I guess we're not on a glibc system */
 
48
# define __THROW   /* __THROW is just an optimization, so ok to make it "" */
 
49
#endif
 
50
 
 
51
#include <stdlib.h>   // for struct mallinfo, if it's defined
 
52
 
 
53
// Annoying stuff for windows -- makes sure clients can import these functions
 
54
#ifndef PERFTOOLS_DLL_DECL
 
55
# ifdef _WIN32
 
56
#   define PERFTOOLS_DLL_DECL  __declspec(dllimport)
 
57
# else
 
58
#   define PERFTOOLS_DLL_DECL
 
59
# endif
 
60
#endif
 
61
 
 
62
#ifdef __cplusplus
 
63
#include <new>  // for nothrow_t
 
64
extern "C" {
 
65
#endif
 
66
  // Returns a human-readable version string.  If major, minor,
 
67
  // and/or patch are not NULL, they are set to the major version,
 
68
  // minor version, and patch-code (a string, usually "").
 
69
  PERFTOOLS_DLL_DECL const char* tc_version(int* major, int* minor,
 
70
                                            const char** patch) __THROW;
 
71
 
 
72
  PERFTOOLS_DLL_DECL void* tc_malloc(size_t size) __THROW;
 
73
  PERFTOOLS_DLL_DECL void tc_free(void* ptr) __THROW;
 
74
  PERFTOOLS_DLL_DECL void* tc_realloc(void* ptr, size_t size) __THROW;
 
75
  PERFTOOLS_DLL_DECL void* tc_calloc(size_t nmemb, size_t size) __THROW;
 
76
  PERFTOOLS_DLL_DECL void tc_cfree(void* ptr) __THROW;
 
77
 
 
78
  PERFTOOLS_DLL_DECL void* tc_memalign(size_t __alignment,
 
79
                                       size_t __size) __THROW;
 
80
  PERFTOOLS_DLL_DECL int tc_posix_memalign(void** ptr,
 
81
                                           size_t align, size_t size) __THROW;
 
82
  PERFTOOLS_DLL_DECL void* tc_valloc(size_t __size) __THROW;
 
83
  PERFTOOLS_DLL_DECL void* tc_pvalloc(size_t __size) __THROW;
 
84
 
 
85
  PERFTOOLS_DLL_DECL void tc_malloc_stats(void) __THROW;
 
86
  PERFTOOLS_DLL_DECL int tc_mallopt(int cmd, int value) __THROW;
 
87
#if 0
 
88
  PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) __THROW;
 
89
#endif
 
90
 
 
91
#ifdef __cplusplus
 
92
  PERFTOOLS_DLL_DECL void* tc_new(size_t size);
 
93
  PERFTOOLS_DLL_DECL void tc_delete(void* p) __THROW;
 
94
  PERFTOOLS_DLL_DECL void* tc_newarray(size_t size);
 
95
  PERFTOOLS_DLL_DECL void tc_deletearray(void* p) __THROW;
 
96
 
 
97
  PERFTOOLS_DLL_DECL void* tc_new_nothrow(size_t size,
 
98
                                          const std::nothrow_t&) __THROW;
 
99
  PERFTOOLS_DLL_DECL void* tc_newarray_nothrow(size_t size,
 
100
                                               const std::nothrow_t&) __THROW;
 
101
}
 
102
#endif
 
103
 
 
104
#endif  // #ifndef TCMALLOC_TCMALLOC_H_