static void tupledealloc(register PyTupleObject *op) { JyNIDebugOp(JY_NATIVE_FINALIZE, op, -1); register Py_ssize_t i; register Py_ssize_t len = Py_SIZE(op); _JyNI_GC_UNTRACK(op); Py_TRASHCAN_SAFE_BEGIN(op) if (len > 0) { i = len; while (--i >= 0) Py_XDECREF(op->ob_item[i]); #if PyTuple_MAXSAVESIZE > 0 if (len < PyTuple_MAXSAVESIZE && numfree[len] < PyTuple_MAXFREELIST && Py_TYPE(op) == &PyTuple_Type) { JyNIDebugOp(JY_NATIVE_FREE | JY_INLINE_MASK, op, -1); JyNI_CleanUp_JyObject(AS_JY_WITH_GC(op)); op->ob_item[0] = (PyObject *) free_list[len]; numfree[len]++; free_list[len] = op; // jputs("Release tuple to free_list"); // jputsLong(len); // jputsLong((jlong) op); goto done; /* return */ } #endif } JyNI_CleanUp_JyObject(AS_JY_WITH_GC(op)); Py_TYPE(op)->tp_free((PyObject *)op); done: Py_TRASHCAN_SAFE_END(op) }
static void cell_dealloc(PyCellObject *op) { _JyNI_GC_UNTRACK(op); Py_XDECREF(op->ob_ref); PyObject_GC_Del(op); }
void _PyTuple_MaybeUntrack(PyObject *op) { PyTupleObject *t; Py_ssize_t i, n; if (!PyTuple_CheckExact(op) || !_JyNI_GC_IS_TRACKED(op)) return; t = (PyTupleObject *) op; n = Py_SIZE(t); for (i = 0; i < n; i++) { PyObject *elt = PyTuple_GET_ITEM(t, i); /* Tuple with NULL elements aren't fully constructed, don't untrack them yet. */ if (!elt || _JyNI_GC_MAY_BE_TRACKED(elt)) return; } #ifdef SHOW_TRACK_COUNT count_tracked--; count_untracked++; #endif _JyNI_GC_UNTRACK(op); }
static void func_dealloc(PyFunctionObject *op) { _JyNI_GC_UNTRACK(op); // if (op->func_weakreflist != NULL) // PyObject_ClearWeakRefs((PyObject *) op); Py_DECREF(op->func_code); Py_DECREF(op->func_globals); Py_XDECREF(op->func_module); //Py_DECREF(op->func_name); Py_XDECREF(op->func_defaults); //Py_XDECREF(op->func_doc); //Py_XDECREF(op->func_dict); Py_XDECREF(op->func_closure); PyObject_GC_Del(op); }