void garbageCollectOldSpace() { ++gcOldCount; OBJ nextFreeOldObjectBefore = nextFreeOldObject; // if gcInProgress == 1, then the new space GC triggered the old space GC; // if not, trigger the new space GC if(!gcInProgress) { gcInProgress = 1; garbageCollectNewSpace(); } breakTableSize = 10000; allocateBreakTable(); allocateMarkTable(); // the active context's stack pointer should also be saved // but the new space GC already does that markPhase(); compactPhase(oldSpace, nextFreeOldObject); updateOldObjectsPhase(oldSpace, nextFreeOldObject); updateYoungObjectsPhase(newSpace, nextFreeNewObject); updateRegistersPhase(); deallocateBreakTable(); deallocateMarkTable(); gcInProgress = 0; if((1 - (double) (nextFreeOldObjectBefore - nextFreeOldObject) / DEFAULT_OLD_SPACE_SIZE) * 100 < gcOldPercentMin) { gcOldPercentMin = (1 - (double) (nextFreeOldObjectBefore - nextFreeOldObject) / DEFAULT_OLD_SPACE_SIZE) * 100; } gcOldPercentSum += (1 - (double) (nextFreeOldObjectBefore - nextFreeOldObject) / DEFAULT_OLD_SPACE_SIZE) * 100; }
void runCollection() { static StatCounter sc("gc_collections"); sc.log(); if (VERBOSITY("gc") >= 2) printf("Collection #%d\n", ++ncollections); //if (ncollections == 754) { //raise(SIGTRAP); //} markPhase(); sweepPhase(); }
void runCollection() { static StatCounter sc("gc_collections"); sc.log(); ncollections++; if (VERBOSITY("gc") >= 2) printf("Collection #%d\n", ncollections); Timer _t("collecting", /*min_usec=*/10000); markPhase(); sweepPhase(); if (VERBOSITY("gc") >= 2) printf("Collection #%d done\n\n", ncollections); long us = _t.end(); static StatCounter sc_us("gc_collections_us"); sc_us.log(us); }
void runCollection() { static StatCounter sc("gc_collections"); sc.log(); ncollections++; if (VERBOSITY("gc") >= 2) printf("Collection #%d\n", ncollections); Timer _t("collecting", /*min_usec=*/10000); markPhase(); std::list<Box*, StlCompatAllocator<Box*>> weakly_referenced; sweepPhase(weakly_referenced); for (auto o : weakly_referenced) { PyWeakReference** list = (PyWeakReference**)PyObject_GET_WEAKREFS_LISTPTR(o); while (PyWeakReference* head = *list) { assert(isValidGCObject(head)); if (head->wr_object != Py_None) { _PyWeakref_ClearRef(head); if (head->wr_callback) { runtimeCall(head->wr_callback, ArgPassSpec(1), reinterpret_cast<Box*>(head), NULL, NULL, NULL, NULL); head->wr_callback = NULL; } } } } if (VERBOSITY("gc") >= 2) printf("Collection #%d done\n\n", ncollections); long us = _t.end(); static StatCounter sc_us("gc_collections_us"); sc_us.log(us); // dumpHeapStatistics(); }
//Do garbage collection void collect(int s[], int sp) { markPhase(s, sp); heapStatistics(); sweepPhase(); heapStatistics(); }