mantid
mantid copied to clipboard
Possible memory leak
Please read all comments to get full picture of the issue, as the problem appears to be more general than first described here.
Describe the bug
We've had reports of Mantid crashing due to memory use when users are auto-processing INTER experiment data while time slicing. I've done a bit of investigating and it looks to me like there may be a memory leak somewhere. This is most noticeable when we time slice in the GUI.
To Reproduce
The easiest way to replicate is as follows:
- Go to the
Interfaces
->Reflectometry
->ISIS Reflectometry
. - On the Runs tab, in the first row of the table on the right hand side enter run
77064
and angle0.8
. - On the Event Handling tab, under the "Uniform slicing" section select the
(sec) slices
radio box and enter5
to slice the data into 5 second slices. - On the Experiment Settings tab enter the following into the first row of the Settings Lookup table:
- ROI:
3-258
- ROI Detector IDS:
3001-3256,4001-4256,5001-5256,6001-6256,7001-7256,8001-8256,9001-9256,10001-10256
- ROI:
- Back on the Runs tab, click the process button. This should complete successfully and create a set of workspace groups. Take a note of the memory usage at this stage.
- Clear the workspace list using the button in Mantid Workbench. The memory use won't go down, but I don't think this in itself necessarily indicates a memory leak, as it can just be that the system hasn't retrieved the memory yet. To demonstrate the leak, in the Reflectometry GUI click to process the row again. The memory usage should continue to build up. If you keep doing this in a loop (5 or 6 times usually, clearing the workspace list in between) the memory completely fills up and Mantid eventually crashes.
If I do the above without the GUI (i.e. calling ReflectometryISISLoadAndProcess
from a script while time-slicing and clearing workspaces between each run) then the memory doesn't seem to build up very much at all. If I run the algorithm directly from the algorithm dialog then the memory does build up more quickly and eventually causes a crash.
Expected behavior
Repeated processing of the data should not cause the memory to fill up and cause a crash if the workspace list is being cleared in between.
Platform/Version (please complete the following information):
- IDAaaS, can't replicate on Windows, need to test on Linux and potentially Mac
- Mantid Version - seems to be a problem in the Nightly, can't replicate it in version 6.9.1 or earlier.
Additional Information Another way I've tested is to run this script repeatedly, which does not perform the time slicing, clearing the workspaces in between:
from mantid.simpleapi import *
import matplotlib.pyplot as plt
import numpy as np
num = 77064
for i in range(50):
num = num + 1
ReflectometryISISLoadAndProcess(InputRunList=str(num),ThetaIn=0.8,ROIDetectorIDs="3001-3256,4001-4256,5001-5256,6001-6256,7001-7256,8001-8256,9001-9256,10001-10256",ProcessingInstructions="3-258")
I haven't been able to crash Mantid using this script, though, even though the memory fills up to over 90% if run repeatedly. The memory builds up pretty slowly when tested in this way.