Ticket #11589 (closed: fixed)
Memory not released after getting last algorithm from history in Python
Reported by: | Martyn Gigg | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | Release 3.4 |
Component: | Framework | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | NickDraper |
Description
This was first noticed on SANS when running the add files section of the ISIS SANS scripts.
The following script will reproduce the problem:
def foo(): wsName= 'AddFilesSumTempory' filename = "SANS2D00028546.nxs" outWs = Load(Filename=filename,OutputWorkspace=wsName) props = outWs.getHistory().lastAlgorithm() LoadEventNexus(Filename=filename, OutputWorkspace='AddFilesSumTempory', LoadMonitors=True) DeleteWorkspace('AddFilesSumTempory') DeleteWorkspace('AddFilesSumTempory_monitors') for i in range(1): foo()
After execution you should see that no workspaces are left but checking the memory usage of the MantidPlot executable still shows a sizeable amount of memory being used. Note that this should be a generic problem and not limited to SANS files.
If you run "Clear All Memory" then the memory is returned as expected.
Change History
comment:2 Changed 5 years ago by Martyn Gigg
- Status changed from inprogress to verify
- Resolution set to fixed
This is being verified as pull request #614.
comment:3 Changed 5 years ago by Martyn Gigg
Fix expected error string
The message is now just what comes out for the factory Refs #11589
Changeset: 8ca545a5464c05ba37050a076f0ab2406e6c4acb
comment:4 Changed 5 years ago by Martyn Gigg
Fix crash in SANS reduction.
Python doesn't seem to guarantee that the shared_ptr will survive during a chained method call. This is poor coding practice anyway... Refs #11589
Changeset: 66908103bf092fc1a0ed28ef0a5355721aa8ee99
comment:5 Changed 5 years ago by NickDraper
- Status changed from verify to closed
- Tester set to NickDraper
Merge pull request #614 from mantidproject/11589_memory_lost_on_get_history
Fix memory "leak" when retrieving history from Python
Full changeset: 4434327bc022acf95e2228affcb6d7be7507f8da
Use an unmanaged algorithm when creating from a string
There is no reason the algorithm should be retained in the manager. Refs #11589
Changeset: 495144416e5046e4e119e29f0cc0655ad83d6bf0