Skip to content

There may be a memory leak #742

Closed
Closed
@123shang60

Description

@123shang60

What version of regex are you using?

1.4.3

Describe the bug at a high level.

When used in large quantities, the memory will continue to grow

What are the steps to reproduce the behavior?

use regex::bytes::Regex;

fn main() {
    loop {
        let input = "NGS>";
        let reg = Regex::new(r#"(?m)(\x1b|\[[0-9;]*[a-zA-Z])"#).unwrap();
        let _ = reg.replace_all(input.as_bytes(), "".as_bytes());
    }
}

What is the actual behavior?

After running for 10 minutes, the memory consumption increased to 1GB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions