> 
> I just know some of the basic rules on how to use memory efficiently
> in a GC environment.  One possible memory leak is the
> protected/private memory leak, which is a major problem in Java that
> is somewhat equivalent to the classical memory leak in languages such
> as C and C++.  What this memory leak is where a reference to an object
There is no such animal in Java.

> is passed to another object through a function call.  The other object
> stores the reference in a protected or private variable, list, array,
> etc. so that when the main program loses the reference to the object a
> non-circular reference to the object still exists.  The main way to
> solve this problem is to properly use remove/unregister/delete
> functions to do stuff like properly remove references to things such
> as listeners from objects.
This is unnecessary in Java.  You can certainly help the GC this way, but
unlike bolt-on GC in other languages, its not really necessary.

> 
> The problem with GC is that it has a tendency to make programmers
> forget that memory management is important.  Even with GC, you still
> have to worry about memory leaks and memory usage.  With languages
> such as C and C++, you *must* pay attention to these things, while GC
> often allows programmers to forget about these things because GC
> handles a lot of this stuff behind the scenes.
No you don't.  You're thinking about GC in languages that weren't designed
for it.



_______________________________________________
Freenet-dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/freenet-dev

Reply via email to