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

Side by Side Diff: third_party/tcmalloc/vendor/src/gperftools/malloc_extension.h

Issue 9702045: Update the tcmalloc vendor branch to r144 (gperftools 2.0), and README.chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2005, Google Inc. 1 // Copyright (c) 2005, 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Call this very early in the program execution -- say, in a global 93 // Call this very early in the program execution -- say, in a global
94 // constructor -- to set up parameters and state needed by all 94 // constructor -- to set up parameters and state needed by all
95 // instrumented malloc implemenatations. One example: this routine 95 // instrumented malloc implemenatations. One example: this routine
96 // sets environemnt variables to tell STL to use libc's malloc() 96 // sets environemnt variables to tell STL to use libc's malloc()
97 // instead of doing its own memory management. This is safe to call 97 // instead of doing its own memory management. This is safe to call
98 // multiple times, as long as each time is before threads start up. 98 // multiple times, as long as each time is before threads start up.
99 static void Initialize(); 99 static void Initialize();
100 100
101 // See "verify_memory.h" to see what these routines do 101 // See "verify_memory.h" to see what these routines do
102 virtual bool VerifyAllMemory(); 102 virtual bool VerifyAllMemory();
103 // TODO(csilvers): change these to const void*. 103 virtual bool VerifyNewMemory(const void* p);
104 virtual bool VerifyNewMemory(void* p); 104 virtual bool VerifyArrayNewMemory(const void* p);
105 virtual bool VerifyArrayNewMemory(void* p); 105 virtual bool VerifyMallocMemory(const void* p);
106 virtual bool VerifyMallocMemory(void* p);
107 virtual bool MallocMemoryStats(int* blocks, size_t* total, 106 virtual bool MallocMemoryStats(int* blocks, size_t* total,
108 int histogram[kMallocHistogramSize]); 107 int histogram[kMallocHistogramSize]);
109 108
110 // Get a human readable description of the current state of the malloc 109 // Get a human readable description of the current state of the malloc
111 // data structures. The state is stored as a null-terminated string 110 // data structures. The state is stored as a null-terminated string
112 // in a prefix of "buffer[0,buffer_length-1]". 111 // in a prefix of "buffer[0,buffer_length-1]".
113 // REQUIRES: buffer_length > 0. 112 // REQUIRES: buffer_length > 0.
114 virtual void GetStats(char* buffer, int buffer_length); 113 virtual void GetStats(char* buffer, int buffer_length);
115 114
116 // Outputs to "writer" a sample of live objects and the stack traces 115 // Outputs to "writer" a sample of live objects and the stack traces
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // tcmalloc 162 // tcmalloc
164 // -------- 163 // --------
165 // "tcmalloc.max_total_thread_cache_bytes" 164 // "tcmalloc.max_total_thread_cache_bytes"
166 // Upper limit on total number of bytes stored across all 165 // Upper limit on total number of bytes stored across all
167 // per-thread caches. Default: 16MB. 166 // per-thread caches. Default: 16MB.
168 // 167 //
169 // "tcmalloc.current_total_thread_cache_bytes" 168 // "tcmalloc.current_total_thread_cache_bytes"
170 // Number of bytes used across all thread caches. 169 // Number of bytes used across all thread caches.
171 // This property is not writable. 170 // This property is not writable.
172 // 171 //
172 // "tcmalloc.central_cache_free_bytes"
173 // Number of free bytes in the central cache that have been
174 // assigned to size classes. They always count towards virtual
175 // memory usage, and unless the underlying memory is swapped out
176 // by the OS, they also count towards physical memory usage.
177 // This property is not writable.
178 //
179 // "tcmalloc.transfer_cache_free_bytes"
180 // Number of free bytes that are waiting to be transfered between
181 // the central cache and a thread cache. They always count
182 // towards virtual memory usage, and unless the underlying memory
183 // is swapped out by the OS, they also count towards physical
184 // memory usage. This property is not writable.
185 //
186 // "tcmalloc.thread_cache_free_bytes"
187 // Number of free bytes in thread caches. They always count
188 // towards virtual memory usage, and unless the underlying memory
189 // is swapped out by the OS, they also count towards physical
190 // memory usage. This property is not writable.
191 //
173 // "tcmalloc.pageheap_free_bytes" 192 // "tcmalloc.pageheap_free_bytes"
174 // Number of bytes in free, mapped pages in page heap. These 193 // Number of bytes in free, mapped pages in page heap. These
175 // bytes can be used to fulfill allocation requests. They 194 // bytes can be used to fulfill allocation requests. They
176 // always count towards virtual memory usage, and unless the 195 // always count towards virtual memory usage, and unless the
177 // underlying memory is swapped out by the OS, they also count 196 // underlying memory is swapped out by the OS, they also count
178 // towards physical memory usage. This property is not writable. 197 // towards physical memory usage. This property is not writable.
179 // 198 //
180 // "tcmalloc.pageheap_unmapped_bytes" 199 // "tcmalloc.pageheap_unmapped_bytes"
181 // Number of bytes in free, unmapped pages in page heap. 200 // Number of bytes in free, unmapped pages in page heap.
182 // These are bytes that have been released back to the OS, 201 // These are bytes that have been released back to the OS,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // allocation). This number may be equal to or greater than the number 293 // allocation). This number may be equal to or greater than the number
275 // of bytes requested when p was allocated. 294 // of bytes requested when p was allocated.
276 // p must have been allocated by this malloc implementation, 295 // p must have been allocated by this malloc implementation,
277 // must not be an interior pointer -- that is, must be exactly 296 // must not be an interior pointer -- that is, must be exactly
278 // the pointer returned to by malloc() et al., not some offset 297 // the pointer returned to by malloc() et al., not some offset
279 // from that -- and should not have been freed yet. p may be NULL. 298 // from that -- and should not have been freed yet. p may be NULL.
280 // (Currently only implemented in tcmalloc; other implementations 299 // (Currently only implemented in tcmalloc; other implementations
281 // will return 0.) 300 // will return 0.)
282 // This is equivalent to malloc_size() in OS X, malloc_usable_size() 301 // This is equivalent to malloc_size() in OS X, malloc_usable_size()
283 // in glibc, and _msize() for windows. 302 // in glibc, and _msize() for windows.
284 // TODO(csilvers): change to const void*. 303 virtual size_t GetAllocatedSize(const void* p);
285 virtual size_t GetAllocatedSize(void* p);
286 304
287 // Returns kOwned if this malloc implementation allocated the memory 305 // Returns kOwned if this malloc implementation allocated the memory
288 // pointed to by p, or kNotOwned if some other malloc implementation 306 // pointed to by p, or kNotOwned if some other malloc implementation
289 // allocated it or p is NULL. May also return kUnknownOwnership if 307 // allocated it or p is NULL. May also return kUnknownOwnership if
290 // the malloc implementation does not keep track of ownership. 308 // the malloc implementation does not keep track of ownership.
291 // REQUIRES: p must be a value returned from a previous call to 309 // REQUIRES: p must be a value returned from a previous call to
292 // malloc(), calloc(), realloc(), memalign(), posix_memalign(), 310 // malloc(), calloc(), realloc(), memalign(), posix_memalign(),
293 // valloc(), pvalloc(), new, or new[], and must refer to memory that 311 // valloc(), pvalloc(), new, or new[], and must refer to memory that
294 // is currently allocated (so, for instance, you should not pass in 312 // is currently allocated (so, for instance, you should not pass in
295 // a pointer after having called free() on it). 313 // a pointer after having called free() on it).
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 411
394 // Perhaps add the following: 412 // Perhaps add the following:
395 // - stack trace if this range was sampled 413 // - stack trace if this range was sampled
396 // - heap growth stack trace if applicable to this range 414 // - heap growth stack trace if applicable to this range
397 // - age when allocated (for inuse) or freed (if not in use) 415 // - age when allocated (for inuse) or freed (if not in use)
398 }; 416 };
399 417
400 } // namespace base 418 } // namespace base
401 419
402 #endif // BASE_MALLOC_EXTENSION_H_ 420 #endif // BASE_MALLOC_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698