New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python3.10.5 Pattern Matching Excessive Memory Consumption #93671
Labels
Comments
Wow. I can reproduce this on 3.11 and 3.12(main) too. |
This seems like a parser issue. Linux perf output: Samples: 36K of event 'cpu-clock:pppH', Event count (approx.): 9100000000
Overhead Command Shared Object Symbol
7.30% python python [.] _PyPegen_expect_token
6.68% python [kernel.kallsyms] [k] clear_page_erms
6.28% python [kernel.kallsyms] [k] __do_page_fault
4.64% python python [.] closed_pattern_rule
4.09% python python [.] _PyArena_Malloc
3.36% python python [.] signed_real_number_rule
3.09% python libc-2.31.so [.] _int_malloc
3.05% python python [.] or_pattern_rule
2.84% python python [.] unicodekeys_lookup_unicode |
It might be the related to the depth of the statement, the following also produces a crash match p:
case [[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]:
pass |
pablogsal
added a commit
to pablogsal/cpython
that referenced
this issue
Jun 10, 2022
…nce patterns in match statements
Thanks, @tom-p-reichel and @dignissimus for the report and thanks a lot @kumaraditya303 for the initial investigation. Great work! |
pablogsal
added a commit
to pablogsal/cpython
that referenced
this issue
Jun 10, 2022
…nce patterns in match statements
pablogsal
added a commit
to pablogsal/cpython
that referenced
this issue
Jun 10, 2022
…nce patterns in match statements
ambv
added a commit
that referenced
this issue
Jun 10, 2022
…tterns in match statements (GH-93680) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Jun 10, 2022
…nce patterns in match statements (pythonGH-93680) Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 53a8b17) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
pablogsal
added a commit
to pablogsal/cpython
that referenced
this issue
Jun 10, 2022
…d sequence patterns in match statements (pythonGH-93680) Co-authored-by: Łukasz Langa <lukasz@langa.pl>. (cherry picked from commit 53a8b17) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
pablogsal
added a commit
that referenced
this issue
Jun 10, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Crash report
While writing some code to match a particularly complicated AST, I accidentally wrote a function whose definition causes the Python 3.10.5 interpreter to rapidly consume memory. On my system, it consumed approximately 24 GBs of memory before being killed.
The function is as follows:
To replicate, paste the above function into a python file and run it.
Error messages
OOM killing produced no output, save for
Killed
.Your environment
The text was updated successfully, but these errors were encountered: