Ticket #184 (closed: fixed)

Opened 12 years ago

Last modified 5 years ago

Python garbage collection can delete objects from Mantid (bad!)

Reported by: Matt Clarke Owned by:
Priority: major Milestone: Iteration 11
Component: Keywords:
Cc: Blocked By:
Blocking: Tester:

Description

Some objects returned to Python from Mantid are now owned by Python, so if Python garbage collects them then Mantid can be holding pointers to junk.

Short term fix: Let python refer to the existing objects without taking ownership. This will make Mantid "safe", but does present problems in python if Mantid deletes one of its objects and python holds a pointer to that object.

Possible long term fix: try to give Python smart pointers pointing to Mantid objects. If the object is "deleted" by Mantid, it is not really deleted as python still has a reference. Potentially this could cause problems regarding memory use.

Change History

comment:1 Changed 12 years ago by Matt Clarke

(In [1238]) Changed pythonWrapper so that any object it returns to python are still owned by mantid. This means if you have a workspace object in python and then delete it in Mantid, then the python object points at unallocated memory and will abort if used. Refs #184

comment:2 Changed 12 years ago by Nick Draper

  • Status changed from new to closed
  • Resolution set to fixed

comment:3 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 1032

Note: See TracTickets for help on using tickets.