/// <summary> /// Common finalization code to support custom tp_deallocs. /// </summary> public static void FinalizeObject(ManagedType self) { ClearObjectDict(self.pyHandle); Runtime.PyObject_GC_Del(self.pyHandle); // Not necessary for decref of `tpHandle`. self.FreeGCHandle(); }
/// <summary> /// Standard dealloc implementation for instances of reflected types. /// </summary> public static void tp_dealloc(IntPtr ob) { ManagedType self = GetManagedObject(ob); tp_clear(ob); Runtime.PyObject_GC_UnTrack(self.pyHandle); Runtime.PyObject_GC_Del(self.pyHandle); self.FreeGCHandle(); }