~ubuntu-branches/ubuntu/jaunty/google-perftools/jaunty

« back to all changes in this revision

Viewing changes to src/google/malloc_extension.h

  • Committer: Bazaar Package Importer
  • Author(s): Daigo Moriwaki
  • Date: 2008-06-15 23:41:36 UTC
  • mfrom: (3.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20080615234136-al5gawvdvt5vhdtz
Tags: 0.98-1
* New upstream release. (Closes: #425147)
* Compiled with GCC 4.3. (Closes: #454841)
* debian/watch: can now report upstream's version (Closes: #450294)
* Because of a file conflict between tau and libgoogle-perftools the
  binary pprof is renamed as google-pprof. (Closes: #404001)
  Great thanks to Michael Mende.
* debian/rules: autoconf files are now generated at the build time.
* Bumped up Standards-Version to 3.7.3, no changes are required.
* Split a new package, libtcmallc_minimal0. The upstream supports
  this module for wider platforms. So I leave its architecture to be
  `any'.
* libgoogle-perftools0's architecture is now i386. The upstream
  supports this module for x86 and x86_64. However, x86_64 requires
  libunwind's development head, which Debian does not have yet.
* Removed an unnecessary patch, debian/patches/02_profiler.cc_alpha.diff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
// ---
31
31
// Author: Sanjay Ghemawat <opensource@google.com>
32
32
//
33
 
// Extra interfaces exported by some malloc implementations.  These
34
 
// interfaces are accessed through a virtual base class so an
 
33
// Extra extensions exported by some malloc implementations.  These
 
34
// extensions are accessed through a virtual base class so an
35
35
// application can link against a malloc that does not implement these
36
 
// interfaces, and it will get default versions that do nothing.
 
36
// extensions, and it will get default versions that do nothing.
37
37
 
38
 
#ifndef _GOOGLE_MALLOC_EXTENSION_H__
39
 
#define _GOOGLE_MALLOC_EXTENSION_H__
 
38
#ifndef BASE_MALLOC_EXTENSION_H_
 
39
#define BASE_MALLOC_EXTENSION_H_
40
40
 
41
41
#include <stddef.h>
42
42
#include <string>
43
43
 
 
44
// Annoying stuff for windows -- makes sure clients can import these functions
 
45
#ifndef PERFTOOLS_DLL_DECL
 
46
# ifdef WIN32
 
47
#   define PERFTOOLS_DLL_DECL  __declspec(dllimport)
 
48
# else
 
49
#   define PERFTOOLS_DLL_DECL
 
50
# endif
 
51
#endif
 
52
 
44
53
static const int kMallocHistogramSize = 64;
45
54
 
46
55
// The default implementations of the following routines do nothing.
47
 
class MallocExtension {
 
56
// All implementations should be thread-safe; the current one
 
57
// (TCMallocImplementation) is.
 
58
class PERFTOOLS_DLL_DECL MallocExtension {
48
59
 public:
49
60
  virtual ~MallocExtension();
50
61
 
137
148
  // REQUIRES: property != NULL
138
149
  virtual bool SetNumericProperty(const char* property, size_t value);
139
150
 
 
151
  // Mark the current thread as "idle".  This routine may optionally
 
152
  // be called by threads as a hint to the malloc implementation that
 
153
  // any thread-specific resources should be released.  Note: this may
 
154
  // be an expensive routine, so it should not be called too often.
 
155
  //
 
156
  // Also, if the code that calls this routine will go to sleep for
 
157
  // a while, it should take care to not allocate anything between
 
158
  // the call to this routine and the beginning of the sleep.
 
159
  //
 
160
  // Most malloc implementations ignore this routine.
 
161
  virtual void MarkThreadIdle();
 
162
 
 
163
  // Try to free memory back to the operating system for reuse.  Only
 
164
  // use this extension if the application has recently freed a lot of
 
165
  // memory, and does not anticipate using it again for a long time --
 
166
  // to get this memory back may require faulting pages back in by the
 
167
  // OS, and that may be slow.  (Currently only implemented in
 
168
  // tcmalloc.)
 
169
  virtual void ReleaseFreeMemory();
 
170
 
140
171
  // The current malloc implementation.  Always non-NULL.
141
172
  static MallocExtension* instance();
142
173
 
170
201
  virtual void** ReadHeapGrowthStackTraces();
171
202
};
172
203
 
173
 
#endif  // _GOOGLE_MALLOC_EXTENSION_H__
 
204
#endif  // BASE_MALLOC_EXTENSION_H_