Skip to content

Pardiso leaks memory #593

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

Open
termi-official opened this issue Apr 3, 2025 · 4 comments
Open

Pardiso leaks memory #593

termi-official opened this issue Apr 3, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@termi-official
Copy link
Contributor

Describe the bug 🐞

Pardiso leaks memory. This is an issue for long-running simulations with potentially thousands of linear solve calls.

Expected behavior

Pardiso should not leak memory.

Minimal Reproducible Example 👇

See this comment in the extension

# Pardiso.set_phase!(cache.cacheval, Pardiso.RELEASE_ALL)

Additional context

I am pretty sure we should call phase -1 after each solve (or at least phase 0) to release the internal buffers.

@termi-official termi-official added the bug Something isn't working label Apr 3, 2025
@ChrisRackauckas
Copy link
Member

I think we need to set the finalizer? Not after each solve but on gc?

@termi-official
Copy link
Contributor Author

For small problems that should be sufficient. However, if one solves larger linear systems with some bandwidth we potentially leak in the order of 50mb per solve call (due to the fill-in). If we use this inside a Newton for DAE solvers, then the memory consumption gets out of hand quite quickly if the time interval is not small.

Maybe a compromise is to add some flag to the constructor to decide on the release frequency?

@ChrisRackauckas
Copy link
Member

Well we should free immediately when we can, but if say someone's REPL stays open or something, it should still have a finalizer trigger.

@j-fu
Copy link
Contributor

j-fu commented Apr 27, 2025

May be this can be done on the Pardiso.jl side ? Let us see how the discussion plays out there. It seems that multiple pardiso call with RELEASE_ALL don't harm, but not sure if we can rely on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants