Why does it take Matlab so long to delete handles and objects that are interconnected?

1 view (last 30 days)
I have different maps a and b. The values of that maps are handles to objects that are interconnected to each other. So a(1) links to the object that is also stored in b. That object might even link back to its refferer. When I delete the object it takes very long till Matlab comes out of the busy state. Is there anything I can do about the enourmous time it takes Matlab to delete the obeject?

Answers (2)

Olivier Lartillot
Olivier Lartillot on 5 May 2016
I face the same problem, and I might have an idea about what is happening. It seems due to the fact that the Handle Class Destructor in Matlab features a particular procedure for “Destruction of Objects with Cyclic References”. But this procedure is too slow. I have an idea how to improve that but that would require to toggle off this aforementioned feature. I submitted a question related to that: http://se.mathworks.com/matlabcentral/answers/282772-destruction-of-objects-with-cyclic-references-matlab-automated-procedure-is-much-too-slow-how-to-t

per isakson
per isakson on 21 Apr 2014
Edited: per isakson on 21 Apr 2014
Loren Shure writes in her blog-post, Considering Performance in Object-Oriented MATLAB Code
We continue to look for opportunities to improve MATLAB object
performance and examples from you are very helpful for learning
what changes will make an impact on real applications. If you
have examples or scenarios you want us to look at, please let me
know.
I propose that you prepare an example, which illustrates this slow clean-up, and send it to The MathWorks (tech support and/or Loren directly). And why not attach it to your question?

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!