| 1707 | } |
| 1708 | |
| 1709 | void BFGC::DoCollect(bool doingFullGC) |
| 1710 | { |
| 1711 | BP_ZONE("Collect"); |
| 1712 | |
| 1713 | mThreadId = BfpThread_GetCurrentId(); |
| 1714 | |
| 1715 | mStage = 0; |
| 1716 | |
| 1717 | gTargetFoundCount = 0; |
| 1718 | gMarkTargetCount = 0; |
| 1719 | gMarkTargetMutatorCount = 0; |
| 1720 | |
| 1721 | mCurGCMarkCount = 0; |
| 1722 | mCurMutatorMarkCount = 0; |
| 1723 | mCurGCObjectQueuedCount = 0; |
| 1724 | mCurMutatorObjectQueuedCount = 0; |
| 1725 | mCurObjectDeleteCount = 0; |
| 1726 | mCurFinalizersCalled = 0; |
| 1727 | mCurSweepFoundCount = 0; |
| 1728 | mCurSweepFoundPermanentCount = 0; |
| 1729 | mCurFreedBytes = 0; |
| 1730 | |
| 1731 | if (doingFullGC) |
| 1732 | { |
| 1733 | int nextMark = sCurMarkId + 1; |
| 1734 | if (nextMark == 4) |
| 1735 | nextMark = 1; |
| 1736 | mCurMarkId = nextMark; |
| 1737 | sCurMarkId = nextMark; |
| 1738 | sAllocFlags = sCurMarkId; |
| 1739 | } |
| 1740 | |
| 1741 | mStage = 1; |
| 1742 | |
| 1743 | BFLOG2(GCLog::EVENT_GC_START, sCurMarkId, BfpSystem_TickCount()); |
| 1744 | |
| 1745 | gGCTypeCounts = 0; |
| 1746 | if (!mSkipMark) |
| 1747 | { |
| 1748 | BP_ZONE("MarkStatics"); |
| 1749 | MarkStatics(); |
| 1750 | RawMarkAll(); |
| 1751 | bool success = bf::System::GC::DoCallRootCallbacks(); |
| 1752 | if ((!success) && (!mHadRootError)) |
| 1753 | { |
| 1754 | OutputDebugStringA("WARNING: GC leak detection disabled, a GC root callback disabled it\n"); |
| 1755 | mHadRootError = true; |
| 1756 | } |
| 1757 | } |
| 1758 | |
| 1759 | if (!mSkipMark) |
| 1760 | { |
| 1761 | Beefy::AutoCrit autoCrit(mCritSect); |
| 1762 | BP_ZONE("ExplicitRootsMark"); |
| 1763 | mQueueMarkObjects = true; |
| 1764 | for (int i = 0; i < (int)mExplicitRoots.size(); i++) |
| 1765 | MarkObject(mExplicitRoots[i]); |
| 1766 | mQueueMarkObjects = false; |
nothing calls this directly
no test coverage detected