ipc/chromium/src/base/memory_debug.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/chromium/src/base/memory_debug.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +// Functions used to debug memory usage, leaks, and other memory issues.
     1.9 +// All methods are effectively no-ops unless this program is being run through
    1.10 +// a supported memory tool (currently, only Purify)
    1.11 +
    1.12 +#ifndef BASE_MEMORY_DEBUG_H_
    1.13 +#define BASE_MEMORY_DEBUG_H_
    1.14 +
    1.15 +#include "base/basictypes.h"
    1.16 +
    1.17 +namespace base {
    1.18 +
    1.19 +class MemoryDebug {
    1.20 + public:
    1.21 +  // Since MIU messages are a lot of data, and we don't always want this data,
    1.22 +  // we have a global switch.  If disabled, *MemoryInUse are no-ops.
    1.23 +  static void SetMemoryInUseEnabled(bool enabled);
    1.24 +
    1.25 +  // Dump information about all memory in use.
    1.26 +  static void DumpAllMemoryInUse();
    1.27 +  // Dump information about new memory in use since the last
    1.28 +  // call to DumpAllMemoryInUse() or DumpNewMemoryInUse().
    1.29 +  static void DumpNewMemoryInUse();
    1.30 +
    1.31 +  // Dump information about all current memory leaks.
    1.32 +  static void DumpAllLeaks();
    1.33 +  // Dump information about new memory leaks since the last
    1.34 +  // call to DumpAllLeaks() or DumpNewLeaks()
    1.35 +  static void DumpNewLeaks();
    1.36 +
    1.37 +  // Mark |size| bytes of memory as initialized, so it doesn't produce any UMRs
    1.38 +  // or UMCs.
    1.39 +  static void MarkAsInitialized(void* addr, size_t size);
    1.40 +
    1.41 + private:
    1.42 +  static bool memory_in_use_;
    1.43 +
    1.44 +  DISALLOW_IMPLICIT_CONSTRUCTORS(MemoryDebug);
    1.45 +};
    1.46 +
    1.47 +}  // namespace base
    1.48 +
    1.49 +#endif  // BASE_MEMORY_DEBUG_H_

mercurial