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

Function CheckTcIntegrity

BeefRT/dbg/gc.cpp:470–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468////////////////////////////////////////////
469
470static void CheckTcIntegrity()
471{
472 auto pageHeap = Static::pageheap();
473 if (pageHeap == NULL)
474 return;
475
476#ifdef BF64
477 //BP_ZONE("CheckTcIntegrity");
478
479 Beefy::HashSet<tcmalloc_obj::Span*> spanSet;
480
481 int interiorLen = PageHeap::PageMap::INTERIOR_LENGTH;
482 int leafLen = PageHeap::PageMap::LEAF_LENGTH;
483
484 for (int pageIdx1 = 0; pageIdx1 < PageHeap::PageMap::INTERIOR_LENGTH; pageIdx1++)
485 {
486 PageHeap::PageMap::Node* node1 = Static::pageheap()->pagemap_.root_->ptrs[pageIdx1];
487 if (node1 == NULL)
488 continue;
489 for (int pageIdx2 = 0; pageIdx2 < PageHeap::PageMap::INTERIOR_LENGTH; pageIdx2++)
490 {
491 PageHeap::PageMap::Node* node2 = node1->ptrs[pageIdx2];
492 if (node2 == NULL)
493 continue;
494 for (int pageIdx3 = 0; pageIdx3 < PageHeap::PageMap::LEAF_LENGTH; pageIdx3++)
495 {
496 tcmalloc_obj::Span* span = (tcmalloc_obj::Span*)node2->ptrs[pageIdx3];
497 if (span != NULL)
498 {
499 int expectedStartPage = ((pageIdx1 * PageHeap::PageMap::INTERIOR_LENGTH) + pageIdx2) * PageHeap::PageMap::LEAF_LENGTH + pageIdx3;
500
501 if (span->start == expectedStartPage)
502 {
503 auto result = spanSet.Add(span);
504 BF_ASSERT(result);
505 }
506 }
507 }
508 }
509 }
510
511 int spansFound = spanSet.size();
512
513#endif
514}
515
516////////////////////////////////////////////
517

Callers 2

DebugDumpLeaksMethod · 0.85
ReportMethod · 0.85

Calls 2

AddMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected