Skip to content
This repository was archived by the owner on Apr 24, 2020. It is now read-only.
This repository was archived by the owner on Apr 24, 2020. It is now read-only.

Handle freelists in pytracemalloc 1.0? #2

@vstinner

Description

@vstinner

I almost rewritten pytracemalloc from scratch between versions 0.9 and 1.0. I wrote pytracemalloc 1.0 for Python 3.4. In this Python versions, "int" and "str" don't use freelists anymore. So tracking freelists become less important.

Python 3 uses free lists for the following object types:

  • float
  • tuple, list, set, dict
  • bound method, C function, frame

Python 2 uses free lists for the following object types:

  • int, float, unicode
  • tuple, list, set, dict
  • bound method, C function, frame

The tracemalloc module of Python 3.4 is written on top of the PEP 454 which is simpler than pytracemalloc 0.9.1 because it was not written for pytracemalloc, but to be able to use a custom memory allocator. Tracking freelists is not useful for such use case.
http://legacy.python.org/dev/peps/pep-0445/

pytracemalloc 0.9.1 had 3 options for free lists:

  • Track free lists: track all Python objects. It is the recommended option.
  • Don't track free lists: less accurate, but faster.
  • Disable free lists: track all Python objects, slower.

On embedded devices, disabling free lists killed performances and could not be used. pytracemalloc 1.0 uses the option "Don't track free lists".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions