Prev: createMask.m
Next: Freeing up variable memory
From: Christopher on 2 Jun 2010 12:42 Hello, I'm working with a matlab/java setup to communicate with a robotics simulation environment. The java part of the system contains its own thread for recieving messages from the simulator. Now, the problem is that the java classes persist even after being deleted from the matlab stack. I can call "clear java" and the variable containing the java class is deleted, but the class, and therefore the thread, persists in memory. I can tell because System.out.print will still display messages in MATLAB even after a "clear java" call. I notice significant performance losses after running simulations overnight because there are so many java classes in memory. Is there any way to remove the java class instances from memory entirely? Thanks! Chris
From: us on 2 Jun 2010 12:50 "Christopher " <cwb34(a)drexel.edu> wrote in message <hu61ks$q4t$1(a)fred.mathworks.com>... > Hello, > I'm working with a matlab/java setup to communicate with a robotics simulation environment. The java part of the system contains its own thread for recieving messages from the simulator. > > Now, the problem is that the java classes persist even after being deleted from the matlab stack. I can call "clear java" and the variable containing the java class is deleted, but the class, and therefore the thread, persists in memory. I can tell because System.out.print will still display messages in MATLAB even after a "clear java" call. I notice significant performance losses after running simulations overnight because there are so many java classes in memory. > > Is there any way to remove the java class instances from memory entirely? > > Thanks! > Chris to see what's still living in your ML cache, look at [a,b,c]=inmem; % and (most likely), you'll be surprised... us
From: Christopher on 2 Jun 2010 13:10 Hmm, after I clear java, the class is no longer shown by inmem, but it will still System.out.print to the matlab console. -Chris > > to see what's still living in your ML cache, look at > > [a,b,c]=inmem; > % and (most likely), you'll be surprised... > > us
From: us on 2 Jun 2010 13:33 "Christopher " <cwb34(a)drexel.edu> wrote in message <hu639u$j0a$1(a)fred.mathworks.com>... > Hmm, after I clear java, the class is no longer shown by inmem, but it will still System.out.print to the matlab console. > > -Chris > > > > > to see what's still living in your ML cache, look at > > > > [a,b,c]=inmem; > > % and (most likely), you'll be surprised... > > > > us hmm... but do you really do this import java.lang.* System.out.print('foo'); % foo>> clear java; clear import; % <- ! System.out.print('foo') % foo??? Undefined variable "System" or class "System.out.print". us
From: Christopher on 2 Jun 2010 14:12
"> > hmm... > but do you really do this > > import java.lang.* > System.out.print('foo'); > % foo>> > clear java; > clear import; % <- ! > System.out.print('foo') > % foo??? Undefined variable "System" or class "System.out.print". > > us OK, my machine throws te same error wth that code. I tried "clear java;clear import" with my class instances, but it still doesn't kill the threads from memory. They're still printing to matlab. It's like the java classes can talk to me, but I can't talk to them. -Chris |