Azzera filtri
Azzera filtri

release .net objects

6 visualizzazioni (ultimi 30 giorni)
Roberto Olmi
Roberto Olmi il 8 Gen 2020
Risposto: Roberto Olmi il 8 Gen 2020
If I create a .NET object instance, then that instance is never garbage collected, even if I call "clear all"
  4 Commenti
Roberto Olmi
Roberto Olmi il 8 Gen 2020
I increased the for iterations above to
for i=1:100
this is the result as seen by the memory profiler application:
Capture.PNG
Capture.PNG
Guillaume
Guillaume il 8 Gen 2020
The delete calls should have released all the references that matlab holds to your objects. The garbage collection itself is handled by .Net itself. Could it be that your LayoutLoader keeps hold of references to the objects?

Accedi per commentare.

Risposta accettata

Roberto Olmi
Roberto Olmi il 8 Gen 2020
Dear Guillaume,
thanks a lot for you help. I understood that my objects couldn't be collected because they were used inside a separated thread that was never stopped after object creation.
Stopping that thread before calling delete allows the object to be garbage ollected.
Thanks again
Roberto

Più risposte (0)

Tag

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by