Reset Session programatically in python macro


I’m running a macro with loops that use a lot of memory. What I’d like to do is to clean the memory between loops. However if I add a


in the macro, Paraview crashes.
I tried something like

for x in GetSources().values():

but it doesn’t seem to clean the memory.

Is there a solution to this problem?


This is a known issue, unfortunately.

A work around is to use


Thank you for your reply Cory.
It seems, however, that also the Disconnect() / Connect() method crashes if used in a macro.
Isn’t there any other way to free memory while in use? I could also accept to close and reopen Paraview, as long as it is automated.


I just marked this as a showstopper for the 5.11 release. (Reference the bug Cory pointed at.) I hate crashes, and it looks like there isn’t a workaround. Thanks Gianmarco for reporting.