I have a MATLAB class which contains a reference to a java object
classdef MyClass
properties
j = myJavaClass
end
methods
...
end
end
and after I use it (using clear, scope exit or explicitly setting myClass = 0; ) the java object is still alive - even after calling Runtime.gc.
I see in the dump that the object is still in the JVM heap for the MATLAB process (using jmap -histo pID) and thus I assume MATLAB itself is still referencing the object - despite calling to clear, clear JAVA, clear classes, etc. - nothing helps
Any ideas?