Actually dereferences cached numpy arrays. REQUIRES being called while holding the GIL.
| 50 | // Actually dereferences cached numpy arrays. REQUIRES being called while |
| 51 | // holding the GIL. |
| 52 | void ClearDecrefCache() { |
| 53 | std::vector<void*> cache_copy; |
| 54 | { |
| 55 | mutex_lock ml(*DelayedDecrefLock()); |
| 56 | cache_copy.swap(*DecrefCache()); |
| 57 | } |
| 58 | for (void* obj : cache_copy) { |
| 59 | Py_DECREF(reinterpret_cast<PyObject*>(obj)); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // Structure which keeps a reference to a Tensor alive while numpy has a pointer |
| 64 | // to it. |
no test coverage detected