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

Memory Leak in C++ #16

Closed
chilligerchief opened this issue Jan 25, 2022 · 3 comments
Closed

Memory Leak in C++ #16

chilligerchief opened this issue Jan 25, 2022 · 3 comments

Comments

@chilligerchief
Copy link

chilligerchief commented Jan 25, 2022

Hello,
the module does not free the memory it reserves. Deleting the seq2pat object in python does not change anything.
Running the following code will use up more and more memory as long as the loop runs.

for i in range(2000000):
    seq2pat = Seq2Pat(sequences=[["a","a","a"], ["a","b","c"],["a","b","b"],["a","a","a"], ["a","b","c"],["a","b","b"],["a","a","a"], ["a","b","c"],["a","b","b"]])
    traces = seq2pat.get_patterns(min_frequency=5)
@takojunior
Copy link
Contributor

Thanks @chilligerchief for your interests to our library. This mentioned case and its memory usage haven't been tested. By using your test, we are able to observe it uses more and more memory as long as loop runs. We will look into this and have a fix accordingly.

@chilligerchief
Copy link
Author

Thank you for looking into it. For now I use a hacky fix by calling an external script. Once the process is finished, the memory gets freed. Sadly, I am not comfortable enough in C++ to fix it my own.

@skadio
Copy link
Contributor

skadio commented May 7, 2022

In the most recent version/fix, we made a few improvements in the C++ backend with more explicit memory clean-up. This may or may not help with your specific case. More memory improvements might be possible in the future. This is our best effort in the short term. I liked your suggestion of running it within external script to keep the memory alloc in control —great fix! Thank you again for sharing your feedback

@skadio skadio closed this as completed May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants