Skip to content

Timely deallocation #605

@KubaO

Description

@KubaO

Per the Perceus precise reference counting paper:

  • object liveliness can be tracked precisely: last use in a scope causes deref and possible deallocation, instead of waiting for the scope to be exited
  • the object being deref'd more likely to be in the caches, so the cost of reference counter update and object traversal is lower
  • deallocation is expected then to be faster, and the memory use is lower too since fewer temporary objects dwell around

I haven't checked, but I imagine that Python currently derefs locals when the scope is exited, and not at the point of last reference in the scope.

Is timely deallocation an idea that was raised before - and if not, would that be something worth doing? I presume a proof-of-concept with some reasonable benchmark indicators of improvement would be in order first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions