Do I have to call release() on matlab COM-interfaces?
Show older comments
hCollection = hControl.Plots;
for i = 1:hCollection.Count
hPlot = invoke(hCollection,'Item', i);
Redraw(hPlot)
release(hPlot);
end;
release(hCollection);
My simple question now is: Do I have to call relase on every COM-interface I generate, e.g. by calling invoke()? Currently I do not, as I thought that the MATLAB garbage collector takes care of reference counting and memory release.
Another example below might refine my question. When will the interface "Sheets" be allocated, and not just referenced?
newWBook = xlApp.Sheets.Open(*name*)
% vs.
wBooks = xlApp.Sheets % or invoke(xlApp, 'Sheets')
newWBook = wBooks.Sheets
release(wBooks) % ? ? ? ?
Accepted Answer
More Answers (0)
Categories
Find more on Use COM Objects in MATLAB 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!