3 ms·
It still helps with the loaded .so files and whatnot. The code objects and other things that are immutable. (CPython refcounts those too?)
by pas 7y ago
It still helps with the loaded .so files and whatnot. The code objects and other things that are immutable. (CPython refcounts those too?)
- pdonis 7y ago> The code objects and other things that are immutable. (CPython refcounts those too?) CPython refcounts all objects. Refcounting is not required because of mutability; it's required because the interpreter needs to know when an object's memory can be reclaimed for something else. I don't know if code objects specifically would have their refcounts mutated a lot, since typically they're only referenced by one object, the function that they're the code for. But function objects will have their refcounts mutated every time the function is called, since that sets up a stack frame that grabs a reference to the function object and then releases it when the function returns.
- rcxdude 7y agoThe code and read-only data of .so files will be shared anyway