MCPcopy Create free account
hub / github.com/beefytech/Beef / BfFullReportMemory

Function BfFullReportMemory

IDEHelper/DebugManager.cpp:447–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447void BfFullReportMemory()
448{
449 /*OutputDebugStrF("Testing OOB\n");
450 char* str = new char[12];
451 delete str;
452 char c = str[1];*/
453
454 if (gBfParserCache != NULL)
455 {
456 MemReporter memReporter;
457 memReporter.BeginSection("ParserCache");
458 gBfParserCache->ReportMemory(&memReporter);
459 memReporter.EndSection();
460 memReporter.Report();
461 }
462
463 OutputDebugStrF("Used: %.2fM NumAllocs: %d Allocs: %.2fM\n", (gBfAllocCount - gBfFreeCount) / (1024.0 * 1024.0), gBfNumAllocs, gBfAllocCount / (1024.0 * 1024.0));
464 OutputDebugStrF("ChunkedDataBuffer allocated blocks: %d\n", ChunkedDataBuffer::sBlocksAllocated);
465
466 if (gDebugManager != NULL)
467 {
468 MemReporter memReporter;
469 if (gDebugManager->mDebugger32 != NULL)
470 {
471 memReporter.BeginSection("Debugger32");
472 gDebugManager->mDebugger32->ReportMemory(&memReporter);
473 memReporter.EndSection();
474 }
475 memReporter.BeginSection("Debugger64");
476 gDebugManager->mDebugger64->ReportMemory(&memReporter);
477 memReporter.EndSection();
478 memReporter.Report();
479 }
480
481 BpDump();
482
483#ifdef CAPTURE_ALLOC_SOURCES
484 int memTotal = 0;
485 std::map<String, int> byNameMap;
486 for (int i = 0; i < CAPTURE_ALLOC_POOL_SIZE; i++)
487 {
488 CaptureAllocLocation* allocLoc = gHashCaptureAllocSize[i];
489 if ((allocLoc != NULL) && (allocLoc->mTotalSize > 0))
490 {
491 auto itr = byNameMap.insert(std::map<String, int>::value_type(allocLoc->mSymName, 0));
492 itr.first->second += allocLoc->mTotalSize;
493 memTotal += allocLoc->mTotalSize;
494 }
495 }
496
497 std::multimap<int, String> bySizeMap;
498
499 for (auto kv : byNameMap)
500 {
501 //OutputDebugStrF("%dk %s\n", (kv.second + 1023) / 1024, kv.first.c_str());
502 bySizeMap.insert(std::multimap<int, String>::value_type(-kv.second, kv.first));
503 }
504

Callers 1

Calls 6

BpDumpFunction · 0.85
BeginSectionMethod · 0.80
ReportMemoryMethod · 0.45
EndSectionMethod · 0.45
ReportMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected