bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure · Pull Request #32223 · python/cpython · GitHub
Skip to content

bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure#32223

Closed
ghost wants to merge 8 commits intomainfrom
unknown repository
Closed

bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure#32223
ghost wants to merge 8 commits intomainfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Apr 1, 2022

@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

@serhiy-storchaka
Copy link
Copy Markdown
Member

@ghost
Copy link
Copy Markdown
Author

ghost commented Apr 1, 2022

@ghost ghost closed this Apr 3, 2022
@ghost ghost deleted the repeat_array branch April 4, 2022 06:11
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants