mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
210 stars 123 forks source link

Instrument view leak 1 #34158

Open AnthonyLim23 opened 2 years ago

AnthonyLim23 commented 2 years ago

The instrument view has at least 1 memory leak. Identifying any further leaks will be difficult until this one is fixed.

Describe the bug Open Mantid and make a note of the memory usage. Run the script:

from mantid.simpleapi import *
import matplotlib.pyplot as plt
import numpy as np

for i in range(51909,51915):
    LoadRaw(Filename='/archive/NDXWISH/instrument/data/cycle_22_2/WISH000'+str(i)+'.raw', OutputWorkspace=str(i))
    CropWorkspace(InputWorkspace=str(i), OutputWorkspace=str(i), XMin=6000, XMax=99900)
    ConvertUnits(InputWorkspace=str(i), OutputWorkspace=str(i), Target='Wavelength')

Clear the ADS, notice that the memory usage has (more or less) returned to normal Run the script again Open instrument view on one of the WS's (doesnt matter which) Close instrument view Clear the ADS Notice that the memory usage has gone up (on IDAas I saw an increase from 3.5 to 27) -->

Expected behavior

Screenshots

Platform/Version (please complete the following information):

Additional context

thomashampson commented 2 years ago

I can reproduce this on Windows. However if I do something else after clearing the workspaces, Mantid will hang for a bit and the memory will return back to the expected usage. The something else can be, e.g.:

AnthonyLim23 commented 2 years ago

that is strange! Does that mean the leak is elsewhere?

thomashampson commented 2 years ago

Two other things I've noticed:

I can reproduce this with the SXD dataset in the training course data, which saves a bit of time when testing.

thomashampson commented 2 years ago

For some reason I can only reproduce this in the latest release version (6.4) and not in the nightly.

sf1919 commented 2 months ago

Has anyone tried to reproduce this since v6.4?