MCPcopy Create free account
hub / github.com/cpputest/cpputest / reportMemoryLeak

Method reportMemoryLeak

src/CppUTest/MemoryLeakDetector.cpp:164–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164void MemoryLeakOutputStringBuffer::reportMemoryLeak(MemoryLeakDetectorNode* leak)
165{
166 if (total_leaks_ == 0) {
167 addMemoryLeakHeader();
168 }
169
170 total_leaks_++;
171 outputBuffer_.add("Alloc num (%u) Leak size: %lu Allocated at: %s and line: %d. Type: \"%s\"\n\tMemory: <%p> Content:\n",
172 leak->number_, (unsigned long) leak->size_, leak->file_, (int) leak->line_, leak->allocator_->alloc_name(), (void*) leak->memory_);
173 outputBuffer_.addMemoryDump(leak->memory_, leak->size_);
174
175 if (SimpleString::StrCmp(leak->allocator_->alloc_name(), (const char*) "malloc") == 0)
176 giveWarningOnUsingMalloc_ = true;
177}
178
179void MemoryLeakOutputStringBuffer::stopMemoryLeakReporting()
180{

Callers 1

Calls 3

addMemoryDumpMethod · 0.80
addMethod · 0.45
alloc_nameMethod · 0.45

Tested by

no test coverage detected