- Notifications
You must be signed in to change notification settings - Fork 484
Closed
Labels
Description
What version of regex are you using?
1.9.5
Describe the bug at a high level.
I compiled a regex with a lot of literals as alternatives (~700KiB) and it consumed way too much memory (256MiB).
What are the steps to reproduce the behavior?
Prepare a text file with content like abc|def|text|... but about 700KiB long and ~64K |s (it could be generated from a dict file).
fn main() { let s = std::fs::read_to_string("file").unwrap(); let r = regex::Regex::new(&s); std::thread::sleep(std::time::Duration::from_secs(100)); drop(r); }And then look at the process's memory usage.
What is the actual behavior?
It took up about 256MiB memory. Python only used 31MiB memory.
What is the expected behavior?
I expect it to use less memory than Python, not a lot more.