Closed thanasibakis closed 7 months ago
There's a dramatically reduced version of the MWE.
using OrdinaryDiffEq
function main()
prob = ODEProblem((u,p,t)->u, 1.0, (0.0, 1.0))
while true
init(prob, Tsit5())
end
end
Specifically we seem to be leaking the name of an anonymous function somewhere in the initialization. This memory is permalloced so it doesn't show up in heap size tracking, but does show in top.
Describe the bug 🐞
Running
solve
repeatedly seems to cause a julia program to accumulate an unexpected amount of memory over time (as reported byhtop
). If a place a call tosolve
in awhile true
loop, I am able to watch theMEM%
column ofhtop
gradually grow.I have reproduced this issue on julia versions 1.8, 1.9, and 1.10.
Expected behavior
I would expect the memory to be reused each iteration of the loop (or some nuanced version of that idea). I would expect to be able to run this infinite loop without eventually receiving an Out of Memory error from my operating system, on a machine with tens of gigabytes of RAM.
Minimal Reproducible Example 👇
Run with
julia --threads=8
. Multithreading is not necessary to reproduce, but accelerates the demonstration of the issue.Adapted from https://docs.sciml.ai/DiffEqDocs/stable/getting_started/#ode_other_types
Error & Stacktrace ⚠️
None from julia. However, monitoring the
MEM%
column ofhtop
for the julia process will show a gradually accumulating memory usage.Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
Add any other context about the problem here.