michael@0: // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #include "base/memory_debug.h" michael@0: michael@0: #ifdef PURIFY michael@0: // this #define is used to prevent people from directly using pure.h michael@0: // instead of memory_debug.h michael@0: #define PURIFY_PRIVATE_INCLUDE michael@0: #include "base/third_party/purify/pure.h" michael@0: #endif michael@0: michael@0: namespace base { michael@0: michael@0: bool MemoryDebug::memory_in_use_ = false; michael@0: michael@0: void MemoryDebug::SetMemoryInUseEnabled(bool enabled) { michael@0: memory_in_use_ = enabled; michael@0: } michael@0: michael@0: void MemoryDebug::DumpAllMemoryInUse() { michael@0: #ifdef PURIFY michael@0: if (memory_in_use_) michael@0: PurifyAllInuse(); michael@0: #endif michael@0: } michael@0: michael@0: void MemoryDebug::DumpNewMemoryInUse() { michael@0: #ifdef PURIFY michael@0: if (memory_in_use_) michael@0: PurifyNewInuse(); michael@0: #endif michael@0: } michael@0: michael@0: void MemoryDebug::DumpAllLeaks() { michael@0: #ifdef PURIFY michael@0: PurifyAllLeaks(); michael@0: #endif michael@0: } michael@0: michael@0: void MemoryDebug::DumpNewLeaks() { michael@0: #ifdef PURIFY michael@0: PurifyNewLeaks(); michael@0: #endif michael@0: } michael@0: michael@0: void MemoryDebug::MarkAsInitialized(void* addr, size_t size) { michael@0: #ifdef PURIFY michael@0: PurifyMarkAsInitialized(addr, size); michael@0: #endif michael@0: } michael@0: michael@0: } // namespace base