My application has a memory leak which I found using a MemoryMonitor class that came with the JDK demos I create JComponent subclass instances and add them to a vector. How I get rid of them is to use Vector.remove(int index) But as the memory keeps increasing I want to get rid of these Objects from memory and its not working. Also what is a circular reference and how do I fix it? (I Have a suspicion this might be a problem) Can anyone shed any light on the subject? What can the package java.lang.ref do for me? any good sites? And also what is Load Balancing?
Roy Ben Ami
posted 13 years ago
ok. first of all i dont think your problem is in the vecotr. it should GC your objects once you remove them IF u dont have any more refrences to them or any containers, listeners binding to them. circular refrence is when 2 objects when to each other but no one else it pointing to them at all. thus they are alone in the memory pointing to each other, but no one can reach either of them. this is a problem , but one of no concern to you since the java virtual machine KNOWS to GC cirecular refernces. as for the rest of your questions here are a few good links: link1 link2 link3