Estimate memory requirements of ODE solver

As a debug help, i have added the following to a FunctionCallingCallback:

totalmem = printMem((integrator,State,setup,saved_values)) 
@info "Memory usage: " totalmem integrator = printMem(integrator) State = printMem(State) parameters = printMem(parameters) savedvalues = printMem(saved_values) integOverState = Base.summarysize(integrator) / Base.summarysize(State)

which should give me an overview of all the allocated objects.

┌ Info: Memory usage: 
│   totalmem = "4.598 GiB"
│   integrator = "4.598 GiB"
│   State = "65.552 MiB"
│   parameters = "248.153 MiB"
│   savedvalues = "2.312 MiB"
└   integOverState = 71.821170284851291

Nearly all of the memory is taken by the integrator, and it is about what it should take, i.e. ~72x.
So I take that the ODE should fit comfortably in my memory (even if the state is larger, about 600MB for my original problem). Probably my issue is not within OrdinaryDiffEq I will investigate whether its an issue with the GC not being aggressive enough

1 Like