Track a new object (add to gen0). O(1) — intrusive linked list push_front, no hashing. # Safety obj must be a valid pointer to a PyObject
(&self, obj: NonNull<PyObject>)
| 266 | /// # Safety |
| 267 | /// obj must be a valid pointer to a PyObject |
| 268 | pub unsafe fn track_object(&self, obj: NonNull<PyObject>) { |
| 269 | let obj_ref = unsafe { obj.as_ref() }; |
| 270 | obj_ref.set_gc_tracked(); |
| 271 | obj_ref.set_gc_generation(0); |
| 272 | |
| 273 | self.generation_lists[0].write().push_front(obj); |
| 274 | self.generations[0].count.fetch_add(1, Ordering::SeqCst); |
| 275 | self.alloc_count.fetch_add(1, Ordering::SeqCst); |
| 276 | } |
| 277 | |
| 278 | /// Untrack an object (remove from GC lists). |
| 279 | /// O(1) — intrusive linked list remove by node pointer. |
no test coverage detected