Ticket #6779 (closed: fixed)
Memory leak with Python algorithm properties
Reported by: | Martyn Gigg | Owned by: | Martyn Gigg |
---|---|---|---|
Priority: | critical | Milestone: | Release 2.5 |
Component: | Mantid | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Anders Markvardsen |
Description
It seems that properties declared in a python algorithm never get deleted. This was found when running the Visual Leak Detector on Windows, which reported many leaks from the Python algorithms code.
Change History
comment:2 Changed 8 years ago by Martyn Gigg
Refs #6779 Use shared_ptr as Python HeldType for PythonAlgorithms
This allows us to release Python from managing the memory when the algorithms are created via the instantiator from the factory. It also keeps Python managing the object references correctly when created purely from Python.
Changeset: bd6cd3ac7140fd0adce9fa973f956f93d41f14f2
comment:3 Changed 8 years ago by Martyn Gigg
Refs #6779 Use shared_ptr as Python HeldType for PythonAlgorithms
This allows us to release Python from managing the memory when the algorithms are created via the instantiator from the factory. It also keeps Python managing the object references correctly when created purely from Python.
Changeset: bd6cd3ac7140fd0adce9fa973f956f93d41f14f2
comment:4 Changed 8 years ago by Martyn Gigg
Kill another subtle memory leak. Refs #6779
Two of the PythonAlgorithm declareProperty methods were calling declareProperty on the same class rather than from the base class causing a double clone of the properties.
The names (only on the c++ side) have been changed to avoid future confusion.
Changeset: 43c3bc02dcea2e6d327438b174eabfe5e07318f6
comment:5 Changed 8 years ago by Martyn Gigg
Kill another subtle memory leak. Refs #6779
Two of the PythonAlgorithm declareProperty methods were calling declareProperty on the same class rather than from the base class causing a double clone of the properties.
The names (only on the c++ side) have been changed to avoid future confusion.
Changeset: 43c3bc02dcea2e6d327438b174eabfe5e07318f6
comment:6 Changed 8 years ago by Martyn Gigg
- Status changed from accepted to verify
- Resolution set to fixed
Branch: feature/6779_python_algs_memleak
Tester: This is a difficult on to test. The leaks were discovered using Visual Leak Detector on Windows, which requires a debug build of Mantid and the inclusion of the "vld.h" header in a single source file in each dll that requires checking. For this Kernel,API suffice.
The test script
import mantid
is enough to trigger the leak as it happens when properties are registered in Python.
Of course all of the builds & system tests should be working.
comment:7 Changed 8 years ago by Anders Markvardsen
- Status changed from verify to verifying
- Tester set to Anders Markvardsen
comment:8 Changed 8 years ago by Anders Markvardsen
- Status changed from verifying to closed
The summary of output from a run of visual leak detector is
Visual Leak Detector detected 6034 memory leaks (491716 bytes). Largest number used: 2384441 bytes. Total allocations: 109777615 bytes. Visual Leak Detector is now exiting. The program '[2684] MantidPlot.exe' has exited with code 0 (0x0).
Hence it claim there is still leaks although looking at the very long output this ticket improves this
comment:9 Changed 8 years ago by Martyn Gigg
Refs #6779 Use shared_ptr as Python HeldType for PythonAlgorithms
This allows us to release Python from managing the memory when the algorithms are created via the instantiator from the factory. It also keeps Python managing the object references correctly when created purely from Python.
Changeset: bd6cd3ac7140fd0adce9fa973f956f93d41f14f2
comment:10 Changed 8 years ago by Martyn Gigg
Kill another subtle memory leak. Refs #6779
Two of the PythonAlgorithm declareProperty methods were calling declareProperty on the same class rather than from the base class causing a double clone of the properties.
The names (only on the c++ side) have been changed to avoid future confusion.
Changeset: 43c3bc02dcea2e6d327438b174eabfe5e07318f6
comment:11 Changed 8 years ago by Martyn Gigg
Refs #6779 Use shared_ptr as Python HeldType for PythonAlgorithms
This allows us to release Python from managing the memory when the algorithms are created via the instantiator from the factory. It also keeps Python managing the object references correctly when created purely from Python.
Changeset: bd6cd3ac7140fd0adce9fa973f956f93d41f14f2
comment:12 Changed 8 years ago by Martyn Gigg
Kill another subtle memory leak. Refs #6779
Two of the PythonAlgorithm declareProperty methods were calling declareProperty on the same class rather than from the base class causing a double clone of the properties.
The names (only on the c++ side) have been changed to avoid future confusion.
Changeset: 43c3bc02dcea2e6d327438b174eabfe5e07318f6
comment:13 Changed 7 years ago by Martyn Gigg
Refs #6779 Use shared_ptr as Python HeldType for PythonAlgorithms
This allows us to release Python from managing the memory when the algorithms are created via the instantiator from the factory. It also keeps Python managing the object references correctly when created purely from Python.
Changeset: bd6cd3ac7140fd0adce9fa973f956f93d41f14f2
comment:14 Changed 7 years ago by Martyn Gigg
Kill another subtle memory leak. Refs #6779
Two of the PythonAlgorithm declareProperty methods were calling declareProperty on the same class rather than from the base class causing a double clone of the properties.
The names (only on the c++ side) have been changed to avoid future confusion.
Changeset: 43c3bc02dcea2e6d327438b174eabfe5e07318f6
comment:15 Changed 7 years ago by Martyn Gigg
Refs #6779 Use shared_ptr as Python HeldType for PythonAlgorithms
This allows us to release Python from managing the memory when the algorithms are created via the instantiator from the factory. It also keeps Python managing the object references correctly when created purely from Python.
Changeset: bd6cd3ac7140fd0adce9fa973f956f93d41f14f2
comment:16 Changed 7 years ago by Martyn Gigg
Kill another subtle memory leak. Refs #6779
Two of the PythonAlgorithm declareProperty methods were calling declareProperty on the same class rather than from the base class causing a double clone of the properties.
The names (only on the c++ side) have been changed to avoid future confusion.
Changeset: 43c3bc02dcea2e6d327438b174eabfe5e07318f6
comment:17 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 7625