Title: Python3.10.5 Pattern Matching Excessive Memory Consumption · Issue #93671 · python/cpython · GitHub
Open Graph Title: Python3.10.5 Pattern Matching Excessive Memory Consumption · Issue #93671 · python/cpython
X Title: Python3.10.5 Pattern Matching Excessive Memory Consumption · Issue #93671 · python/cpython
Description: 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...
Open Graph Description: 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 ...
X Description: 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 ...
Opengraph URL: https://github.com/python/cpython/issues/93671
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python3.10.5 Pattern Matching Excessive Memory Consumption","articleBody":"\u003c!--\r\n Use this template for hard crashes of the interpreter, segmentation faults, failed C-level assertions, and similar.\r\n Do not submit this form if you encounter an exception being unexpectedly raised from a Python function.\r\n Most of the time, these should be filed as bugs, rather than crashes.\r\n\r\n The CPython interpreter is itself written in a different programming language, C.\r\n For CPython, a \"crash\" is when Python itself fails, leading to a traceback in the C stack.\r\n--\u003e\r\n\r\n**Crash report**\r\n\r\n\r\nWhile 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.\r\n\r\nThe function is as follows:\r\n\r\n```python\r\ndef defines(self):\r\n match self.ast:\r\n case [S('CoqAst'), [[S('v'), [_, _, [S('expr'), [S('VernacDefinition'), [S('NoDischarge'), S('Definition')], [[[S('v'), [S('Name'), [S('Id'), S(name)]]], _], []], [S('DefineBody'), [], [], [_, _], []]]]]], _]]\r\n | [S('CoqAst'), [[S('v'), [[S('control'), []], [S('attrs'), []], [S('expr'), [S('VernacStartTheoremProof'), S('Theorem'), [[[[[S('v'), [S('Id'), name]], _], []], _]]]]]], _]]:\r\n return name\r\n\r\n```\r\n\r\nTo replicate, paste the above function into a python file and run it.\r\n\r\n**Error messages**\r\n\r\n\r\nOOM killing produced no output, save for `Killed`. \r\n\r\n\r\n**Your environment**\r\n\r\n\u003c!-- Include as many relevant details as possible about the environment you experienced the bug in --\u003e\r\n\r\n- CPython versions tested on: 3.10.5\r\n- Operating system and architecture: Tested on both Windows 10 and ArchLinux. \r\n\r\n\u003c!--\r\nYou can freely edit this text. Remove any lines you believe are unnecessary.\r\n--\u003e\r\n","author":{"url":"https://github.com/tom-p-reichel","@type":"Person","name":"tom-p-reichel"},"datePublished":"2022-06-10T08:07:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/93671/cpython/issues/93671"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:cb6f5eef-118f-719a-210e-b635a761705e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BFDA:CADE5:40DAB4:566B42:69697DF8 |
| html-safe-nonce | eb6d913961d1abc6f82aa614dc687808da177873c8d4b2a5b3b94e614bbcf647 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRkRBOkNBREU1OjQwREFCNDo1NjZCNDI6Njk2OTdERjgiLCJ2aXNpdG9yX2lkIjoiODIxNDk2NjM0ODA1MTc0MjIwMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7bb6d0f16fe297287728094ecb2052d020640655013219508571074257af023c |
| hovercard-subject-tag | issue:1267207204 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/93671/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ab123c3f5310f35d813d6d0ee97e98e369dbd7df3c322c1f2973322d37c7d1f6/python/cpython/issues/93671 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ab123c3f5310f35d813d6d0ee97e98e369dbd7df3c322c1f2973322d37c7d1f6/python/cpython/issues/93671 |
| og:image:alt | 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 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tom-p-reichel |
| hostname | github.com |
| expected-hostname | github.com |
| None | f33e4b94c8824ab2b434d82a94139432fb5ebee9df4b75304140ad22508c4a77 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 48f380098b30acbb700b04f1724481ca10d574fc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width