Пример #1
0
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();
}
Пример #2
0
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);
}
Пример #3
0
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();
}
Пример #4
0
//Do garbage collection
void collect(int s[], int sp) {
  markPhase(s, sp);
  heapStatistics();
  sweepPhase();
  heapStatistics();
}