Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1710)

Unified Diff: third_party/tcmalloc/chromium/src/google/malloc_extension.h

Issue 1076002: Revert 41938 - Merged third_party/tcmalloc/vendor/src(googleperftools r87) in... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/tcmalloc/chromium/src/google/malloc_extension.h
===================================================================
--- third_party/tcmalloc/chromium/src/google/malloc_extension.h (revision 41940)
+++ third_party/tcmalloc/chromium/src/google/malloc_extension.h (working copy)
@@ -42,13 +42,6 @@
#define BASE_MALLOC_EXTENSION_H_
#include <stddef.h>
-// I can't #include config.h in this public API file, but I should
-// really use configure (and make malloc_extension.h a .in file) to
-// figure out if the system has stdint.h or not. But I'm lazy, so
-// for now I'm assuming it's a problem only with MSVC.
-#ifndef _MSC_VER
-#include <stdint.h>
-#endif
#include <string>
// Annoying stuff for windows -- makes sure clients can import these functions
@@ -65,10 +58,6 @@
// One day, we could support other types of writers (perhaps for C?)
typedef std::string MallocExtensionWriter;
-namespace base {
-struct MallocRange;
-}
-
// The default implementations of the following routines do nothing.
// All implementations should be thread-safe; the current one
// (TCMallocImplementation) is.
@@ -110,14 +99,6 @@
// be passed to "pprof".
virtual void GetHeapGrowthStacks(MallocExtensionWriter* writer);
- // Invokes func(arg, range) for every controlled memory
- // range. *range is filled in with information about the range.
- //
- // This is a best-effort interface useful only for performance
- // analysis. The implementation may not call func at all.
- typedef void (RangeFunction)(void*, const base::MallocRange*);
- virtual void Ranges(void* arg, RangeFunction func);
-
// -------------------------------------------------------------------
// Control operations for getting and setting malloc implementation
// specific parameters. Some currently useful properties:
@@ -146,20 +127,12 @@
// This property is not writable.
//
// "tcmalloc.slack_bytes"
- // Number of bytes allocated from system, but not currently in
- // use by malloced objects. I.e., bytes available for
- // allocation without needing more bytes from system. It is
- // the sum of pageheap_free_bytes and pageheap_unmapped_bytes.
+ // Number of bytes allocated from system, but not currently
+ // in use by malloced objects. I.e., bytes available for
+ // allocation without needing more bytes from system.
// This property is not writable.
//
- // "tcmalloc.pageheap_free_bytes"
- // Number of bytes in free, mapped pages in pageheap
- // This property is not writable.
- //
- // "tcmalloc.pageheap_unmapped_bytes"
- // Number of bytes in free, unmapped pages in pageheap
- // This property is not writable.
- //
+ // TODO: Add more properties as necessary
// -------------------------------------------------------------------
// Get the named "property"'s value. Returns true if the property
@@ -194,13 +167,12 @@
// Most malloc implementations ignore this routine.
virtual void MarkThreadBusy();
- // Try to release num_bytes of free memory back to the operating
- // system for reuse. Use this extension with caution -- to get this
- // memory back may require faulting pages back in by the OS, and
- // that may be slow. (Currently only implemented in tcmalloc.)
- virtual void ReleaseToSystem(size_t num_bytes);
-
- // Same as ReleaseToSystem() but release as much memory as possible.
+ // Try to free memory back to the operating system for reuse. Only
+ // use this extension if the application has recently freed a lot of
+ // memory, and does not anticipate using it again for a long time --
+ // to get this memory back may require faulting pages back in by the
+ // OS, and that may be slow. (Currently only implemented in
+ // tcmalloc.)
virtual void ReleaseFreeMemory();
// Sets the rate at which we release unused memory to the system.
@@ -267,29 +239,4 @@
virtual void** ReadHeapGrowthStackTraces();
};
-namespace base {
-
-// Information passed per range. More fields may be added later.
-struct MallocRange {
- enum Type {
- INUSE, // Application is using this range
- FREE, // Range is currently free
- UNMAPPED, // Backing physical memory has been returned to the OS
- UNKNOWN,
- // More enum values may be added in the future
- };
-
- uintptr_t address; // Address of range
- size_t length; // Byte length of range
- Type type; // Type of this range
- double fraction; // Fraction of range that is being used (0 if !INUSE)
-
- // Perhaps add the following:
- // - stack trace if this range was sampled
- // - heap growth stack trace if applicable to this range
- // - age when allocated (for inuse) or freed (if not in use)
-};
-
-} // namespace base
-
#endif // BASE_MALLOC_EXTENSION_H_
« no previous file with comments | « third_party/tcmalloc/chromium/src/google/heap-checker.h ('k') | third_party/tcmalloc/chromium/src/google/malloc_extension_c.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698