Skip to content

memory leaks #2380

Open
Open

Description

@dralley

I was running the microbenchmarks and kept getting SIGTERM, apparently it was exhausting my 16gb of memory + 8gb of swap.

I reran the tests to try to figure out which microbenchmarks were triggering the leaks in RustPython:

  • exception_nested.py

Screenshot from 2020-12-24 14-35-46

  • complex_class.py

Screenshot from 2020-12-24 14-37-51

  • define_function.py

Screenshot from 2020-12-24 14-41-47

  • call_simple.py

Screenshot from 2020-12-24 14-42-09

  • call_kwargs.py

Screenshot from 2020-12-24 14-44-16

  • construct_object.py

Screenshot from 2020-12-24 14-46-25

This is the point where it died again, so maybe there are more. Or maybe they all have the same root causes 🤷

Activity

  1. carbotaniuman commented on Dec 29, 2020

    @carbotaniuman
    Contributor

    This is intentional, we don't have a GC implemented in RustPython yet, so any refernce cycles automatically leak memory.

  2. dralley commented on Dec 29, 2020

    @dralley
    ContributorAuthor

    Does simply calling or defining a function create a reference cycle, though?

  3. coolreader18 commented on Dec 29, 2020

    @coolreader18
    Member

    Yes, I think, since the globals dict gets stored in the function object, and then the function object gets stored in the globals. I think we could get around that by clearing module globals on interpreter shutdown like CPython does, but that would require a defined "interpreter shutdown" phase.

  4. fanninpm commented on Oct 25, 2021

    @fanninpm
    Contributor

    a defined "interpreter shutdown" phase.

    I think the most natural place for that would be a custom Drop impl for either Interpreter or VirtualMachine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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