PyCodeObjects might change
AndreasGocht opened this issue · comments
Until now we assumed, that PyCodeObjects live forever. However, that is not necessarily true, as the objects get destroyed, when the ref counter reaches 0.
Especially during module import code objects get destroyed this way. There are two ways of fixing this:
- increase the ref count when we see a code object
- invalidate the related entry in the hashmap
The first one might lead to oom if someone uses a lot of lambdas or dynamic code objects. However, that needs to be estimated. The second one is difficult as there is no Python intrinsic signal, that an object will get destroyed (at least that I am aware of). We could, however, override the related destruction function. But this might have side effects.
fixed with #145