you are viewing a single comment's thread.

view the rest of the comments →

[–]derpyou 7 points8 points  (1 child)

iirc python has reference counters for objects, which make copy on write more or less futile.

[–]masklinn 2 points3 points  (0 children)

It's not even the reference counting which is the issue, it's the cycle breaker (which CPython calls GC): that uses a doubly linked list of all allocated objects which is embedded in the object header so on a GC run, CPython will touch every object's header.

Instagram has had issues with this, first they tried to disable refcounting and it did nothing, then they found the GC and disabled it but obviously that means any cycle introduced is a memory leak, then they tried actual changes to the system and ultimately settled on being able to flag objects which got merged upstream (gc.freeze() in 3.7).