Thank you very much for posting your work-around to this thread. I know nothing about Java and so I will never be able to find this work-around.
I am just wondering why Mathworks have not fixed this problem.
"Byron" wrote in message <firstname.lastname@example.org>... > "Kevin" wrote in message <email@example.com>... > > I think the solution is to use DOS to do the delete: > > > > dos('del file2.mat'); > > > > This will be the workaround. > > > > Is Java being the problem here? > > > I was reading in a few hundred thousand binary files from a frame grabber and deleting them on the fly with delete(?path\fname?). at around 760k files i got java heap space, out of memory error. > I solved the problem by switching to java.io.File(?path\fname?).delete(), which maintains same speed but no memory leak issues. I tried system(?del path\fname?) but it was 20x slower. > > Just though i?d share incase anyone else needed a faster workaround than the system cmd.