GitXplorerGitXplorer
W

idk

public
4 stars
0 forks
0 issues

Commits

List of commits on branch master.
Verified
97a9482f8c125ad041c8e1b9264b20907b33ba7c

Update README.md

WWolframAlph committed 9 months ago
Verified
31e2108b751e3b179e52e9fe65bb5d5a33ed6a4d

Update README.md

WWolframAlph committed 9 months ago
Unverified
4d6c496ffe890e58fafc194191928a8c56a3c514

initial

WWolframAlph committed a year ago

README

The README file for this repository.

IDK

I dont know how to name this package.

Hook into process of python object deallocation.

import idk


def callback(obj_id):
    print(f"object {obj_id} was deallocated")


x = "delete me"
print(id(x))
idk.watch(x, callback)
del x

Dont confuse object deallocation and __del__ dunder method. __del__ is a finalizer and is called right before object is about to be deallocated. This however, does not guarantee that object was deallocated. Idk patches python in runtime to be able to hook into actual deallocation process and calls your callback right after deallocation routine of object is called. Callback receives 1 parameter which is id of just deallocated object. Important to note that it is still possible to have object alive after its deallocation routine was called in some scenarios under certain circumstances.

Important

This package is meant for education/debugging purposes. This is guaranteed to work only on linux/x86_64 and Python 3.9.0. Other configurations were not tested. Use it at your own risk.