GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure · Pull Request #32223 · python/cpython

Conversation

@ghost

@ghost ghost commented Apr 1, 2022 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

@serhiy-storchaka , please review the commits one by one.

MSVC 2022 non-PGO release build, run test_re.py. It's a bit slower.

(best of 10)
Before: 0.278 sec
After:  0.283 sec

But when switching REPEAT very frequently, it has some speed up:

import pyperf

setup = ("import re;"
         "s = 100_000_000 * 'a';"
         "p = r'.*?(?:bb)+';"
         "p = re.compile(p)")
stmt = "p.match(s)"

runner = pyperf.Runner()
runner.timeit("match", stmt=stmt, setup=setup)

# Before: Mean +- std dev: 1.88 sec +- 0.03 sec
# After:  Mean +- std dev: 1.63 sec +- 0.03 sec

https://bugs.python.org/issue23689

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
wjssz added 8 commits April 1, 2022 13:11
@wjssz
1. add variables
d43cefe
@wjssz
2. add CompileData class to sre_compile.py
f0d2621
@wjssz
3. add repeat_count parameter to _sre.compile() function
b8b9921
argument clinic
@wjssz
4. emit repeat_count in sre_compile.py
17907f5
@wjssz
5. change _validate_outer() parameter
787ca6f
-_validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
+_validate_inner(SRE_CODE *code, SRE_CODE *end, PatternObject *self)
@wjssz
6. validate in _validate_inner()
6ec932b
@wjssz
7. allocate repeats_array for SRE_STATE
01c4c29
@wjssz
8. support code in sre_lib.h
7631b7d
@bedevere-bot bedevere-bot added the awaiting review label Apr 1, 2022
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Apr 1, 2022
@serhiy-storchaka

serhiy-storchaka commented Apr 1, 2022

Copy link
Copy Markdown
Member

My internet connection is very bad last days, so it will take a time for review, sorry.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Apr 1, 2022

Copy link
Copy Markdown
Author

It doesn't matter.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost closed this Apr 3, 2022
@ghost
ghost deleted the repeat_array branch April 4, 2022 06:11
@abacabadabacaba abacabadabacaba mannequin mentioned this pull request Jun 15, 2022
Memory leak in Modules/sre_lib.h #67877
Closed
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@serhiy-storchaka @the-knights-who-say-ni @bedevere-bot @wjssz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.