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

Method FinishCollect

BeefRT/dbg/gc.cpp:1803–1975  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1801}
1802
1803void BFGC::FinishCollect()
1804{
1805 //OutputDebugStrF("Collected %d objects\n", mFinalizeList.size());
1806
1807 if ((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) == 0)
1808 return;
1809
1810 mLastFreeCount = 0;
1811 mStage = 3;
1812
1813 typedef std::unordered_set<bf::System::Object*> BfObjectSet;
1814
1815 {
1816
1817 // Handle any pending data from strong GCHandle references
1818 HandlePendingGCData();
1819 }
1820
1821 int finalizeDataCountFound = 0;
1822
1823 if (mDebugDumpState == DEBUGDUMPSTATE_WAITING_FOR_GC)
1824 {
1825 WriteDebugDumpState();
1826 mDebugDumpState = DEBUGDUMPSTATE_NONE;
1827 }
1828
1829 {
1830 BP_ZONE("FreeingObjects");
1831
1832 void* lastPtr = NULL;
1833 for (int i = 0; i < mFinalizeList.size(); i++)
1834 {
1835 bf::System::Object* obj = mFinalizeList[i];
1836 if (obj == NULL)
1837 continue;
1838 BF_LOGASSERT((obj->mObjectFlags & (/*BF_OBJECTFLAG_FREED |*/ BF_OBJECTFLAG_ALLOCATED)) == BF_OBJECTFLAG_ALLOCATED);
1839
1840 //BF_LOGASSERT(obj > lastPtr);
1841 lastPtr = obj;
1842 }
1843
1844 {
1845 BP_ZONE("ReleaseAtLeastNPages");
1846 SpinLockHolder h(tcmalloc_obj::Static::pageheap_lock());
1847 Static::pageheap()->ReleaseAtLeastNPages(256);
1848 }
1849
1850 {
1851 BP_ZONE("DecommitFromReleasedList");
1852 Static::pageheap()->DecommitFromReleasedList(mForceDecommit);
1853 mForceDecommit = false;
1854 }
1855
1856 Dictionary<bf::System::Type*, int> sizeMap;
1857
1858 int objFreeSize = 0;
1859 for (int i = 0; i < mFinalizeList.size(); i++)
1860 {

Callers

nothing calls this directly

Calls 15

TCGetSpanAtFunction · 0.85
BFGetObjectSizeFunction · 0.85
GCObjFreeFunction · 0.85
findMethod · 0.80
_GetTypeMethod · 0.80
InterlockedIncrementFunction · 0.50
sizeMethod · 0.45
ReleaseAtLeastNPagesMethod · 0.45
eraseMethod · 0.45
TryAddMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected