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

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

Issue 9316021: Update the tcmalloc vendor branch to r144 (gperftools 2.0). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reuploading 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // allocation). This number may be equal to or greater than the number 273 // allocation). This number may be equal to or greater than the number
275 // of bytes requested when p was allocated. 274 // of bytes requested when p was allocated.
276 // p must have been allocated by this malloc implementation, 275 // p must have been allocated by this malloc implementation,
277 // must not be an interior pointer -- that is, must be exactly 276 // must not be an interior pointer -- that is, must be exactly
278 // the pointer returned to by malloc() et al., not some offset 277 // 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. 278 // from that -- and should not have been freed yet. p may be NULL.
280 // (Currently only implemented in tcmalloc; other implementations 279 // (Currently only implemented in tcmalloc; other implementations
281 // will return 0.) 280 // will return 0.)
282 // This is equivalent to malloc_size() in OS X, malloc_usable_size() 281 // This is equivalent to malloc_size() in OS X, malloc_usable_size()
283 // in glibc, and _msize() for windows. 282 // in glibc, and _msize() for windows.
284 // TODO(csilvers): change to const void*. 283 virtual size_t GetAllocatedSize(const void* p);
285 virtual size_t GetAllocatedSize(void* p);
286 284
287 // Returns kOwned if this malloc implementation allocated the memory 285 // Returns kOwned if this malloc implementation allocated the memory
288 // pointed to by p, or kNotOwned if some other malloc implementation 286 // pointed to by p, or kNotOwned if some other malloc implementation
289 // allocated it or p is NULL. May also return kUnknownOwnership if 287 // allocated it or p is NULL. May also return kUnknownOwnership if
290 // the malloc implementation does not keep track of ownership. 288 // the malloc implementation does not keep track of ownership.
291 // REQUIRES: p must be a value returned from a previous call to 289 // REQUIRES: p must be a value returned from a previous call to
292 // malloc(), calloc(), realloc(), memalign(), posix_memalign(), 290 // malloc(), calloc(), realloc(), memalign(), posix_memalign(),
293 // valloc(), pvalloc(), new, or new[], and must refer to memory that 291 // valloc(), pvalloc(), new, or new[], and must refer to memory that
294 // is currently allocated (so, for instance, you should not pass in 292 // is currently allocated (so, for instance, you should not pass in
295 // a pointer after having called free() on it). 293 // a pointer after having called free() on it).
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 391
394 // Perhaps add the following: 392 // Perhaps add the following:
395 // - stack trace if this range was sampled 393 // - stack trace if this range was sampled
396 // - heap growth stack trace if applicable to this range 394 // - heap growth stack trace if applicable to this range
397 // - age when allocated (for inuse) or freed (if not in use) 395 // - age when allocated (for inuse) or freed (if not in use)
398 }; 396 };
399 397
400 } // namespace base 398 } // namespace base
401 399
402 #endif // BASE_MALLOC_EXTENSION_H_ 400 #endif // BASE_MALLOC_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698