Hi
I have the following bit of code, basically keeps getting a list of available Drives on a windows computer (every 2 seconds at the moment but it will be every 30secs).
Trouble is that when running this when watching the memory usage in Task Manager the memory keeps increasing, I have left this running for around 10 minutes and it still increasing.
Is there any reason why this is happening as it SHOULD be just replacing the contents of 'currentDrives' variable.
Thanks
import java.io.File; public class Main { public static void main(String[] args) { File[] currentDrives = File.listRoots(); while(true) { currentDrives = File.listRoots(); try { Thread.sleep(2000); } catch(Exception ex) { System.out.println("Error: " + ex.getMessage()); } } } }