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