pydstool
pydstool copied to clipboard
Inefficient memory usage
While preparing data to be returned to Python, function PackOut
(PyDSTool/integrator/interface.c
) makes a copy of all computed data and doubles amount of used memory as a result.
@z2v Do you know that it's safe to not copy based on possible need for the original data at a later time? For instance, could the returned data be changed in the interface or in python and affect the contents of the solver that might be needed e.g. for continuing an orbit?
@robclewley, AFAIK, both radau and dopri are single-step methods and previously computed trajectory data is not used in solvers.
We can test it without the memory copy, then. My only concern is something like compute
's continue integration option, but we have a test for that use case.
It makes me nervous because it has been almost 10 years since the interface was written by my colleague, and I feel like there could have been a reason that I no longer remember. But since we are keeping a record of this discussion, we might as well try taking out the copy and testing the result. I can also see if I need to think up further tests than we already have to check that all is well.