I wrote a large ( >60 pages ) java program and used swing for a GUI and I was careful to close all of my readers, output streams, and dispose of all frames when the user is done with them. I also do System.gc() at the end of each class so all the garbage should be collected. However I still have a memory leak. About 20MB are leaked for every ten (large) classes the program goes through. How can I be leaking this much memory when I was so careful when writing the code?