ipc/chromium/src/base/memory_debug.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 // Functions used to debug memory usage, leaks, and other memory issues.
michael@0 6 // All methods are effectively no-ops unless this program is being run through
michael@0 7 // a supported memory tool (currently, only Purify)
michael@0 8
michael@0 9 #ifndef BASE_MEMORY_DEBUG_H_
michael@0 10 #define BASE_MEMORY_DEBUG_H_
michael@0 11
michael@0 12 #include "base/basictypes.h"
michael@0 13
michael@0 14 namespace base {
michael@0 15
michael@0 16 class MemoryDebug {
michael@0 17 public:
michael@0 18 // Since MIU messages are a lot of data, and we don't always want this data,
michael@0 19 // we have a global switch. If disabled, *MemoryInUse are no-ops.
michael@0 20 static void SetMemoryInUseEnabled(bool enabled);
michael@0 21
michael@0 22 // Dump information about all memory in use.
michael@0 23 static void DumpAllMemoryInUse();
michael@0 24 // Dump information about new memory in use since the last
michael@0 25 // call to DumpAllMemoryInUse() or DumpNewMemoryInUse().
michael@0 26 static void DumpNewMemoryInUse();
michael@0 27
michael@0 28 // Dump information about all current memory leaks.
michael@0 29 static void DumpAllLeaks();
michael@0 30 // Dump information about new memory leaks since the last
michael@0 31 // call to DumpAllLeaks() or DumpNewLeaks()
michael@0 32 static void DumpNewLeaks();
michael@0 33
michael@0 34 // Mark |size| bytes of memory as initialized, so it doesn't produce any UMRs
michael@0 35 // or UMCs.
michael@0 36 static void MarkAsInitialized(void* addr, size_t size);
michael@0 37
michael@0 38 private:
michael@0 39 static bool memory_in_use_;
michael@0 40
michael@0 41 DISALLOW_IMPLICIT_CONSTRUCTORS(MemoryDebug);
michael@0 42 };
michael@0 43
michael@0 44 } // namespace base
michael@0 45
michael@0 46 #endif // BASE_MEMORY_DEBUG_H_

mercurial