Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Memory leak introduced somewhere from 3.0.1 to 3.2.1 #84

Closed
saarw opened this issue Apr 23, 2018 · 4 comments
Closed

Regression: Memory leak introduced somewhere from 3.0.1 to 3.2.1 #84

saarw opened this issue Apr 23, 2018 · 4 comments

Comments

@saarw
Copy link

saarw commented Apr 23, 2018

We noticed that oniguruma started leaking memory when upgrading from rust-onig 3.0.1 to 3.2.1. It's highly probable that this memory leak is somewhere in the underlying C library, can someone help verify that and post an issue for that project?

I have created a reproducer here that will grow the heap indefinitely (it goes away when I port back to search_with_options in 3.0.1)
https://github.com/saarw/onig_leak

@iwillspeak
Copy link
Collaborator

Thanks for the issue. I'll look into this as soon as possible.

@iwillspeak iwillspeak self-assigned this Apr 23, 2018
@iwillspeak
Copy link
Collaborator

According to Leaks these are created by onig_new_match_param. Presumably at MatchParam::default.

@iwillspeak
Copy link
Collaborator

Looks like by calling mem::transmute in search_with_param it prevents the Drop impl being invoked. Guessing we should fix this by adding an as_raw method to expose the raw pointer rather than using mem::transmute.

@iwillspeak
Copy link
Collaborator

The example no longer leaks with 3.2.2.

@iwillspeak iwillspeak added C-DONE and removed C-DONE labels Jul 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants