>
> Please search the web on how garbage collectors work,
> there is plenty of documentation.
I known this mechanics but do google by you advise. May be industry invent something new...
Second link,
http://www-128.ibm.com/developerworks/library/j-jtp10283/ :
"The benefits of garbage collection are indisputable -- increased reliability, decoupling of memory management from class interface design, and less developer time spent chasing memory management errors. The well-known problems of dangling pointers and memory leaks simply do not occur in Java programs. (Java programs can exhibit a form of memory leak, more accurately called unintentional object retention, but this is a different problem.) However, garbage collection is not without its costs -- among them performance impact, pauses, configuration complexity, and nondeterministic finalization."
See phrase in parenthesis. It point to same problem that I describe. And keep in mind that C++ pointers can be passed to the another subsystems which not under control of garbage collector. This is not closed Java world. For example in Windows GUI programming I can store one available reference to object in special lParam data field what maintained internally by common controls such as TreeView, ListView and so on. How garbage collector will known that this object live if no other references to it exists? This object must by deleted only in response to the special Windows message, not by any collectors.
> > I'm afraid that if garbage collection will become the
> > he part of standard runtime support then any novice or
> > semi-skilled programmer will never think about the
> memory
> > managament rely on the garbage collector possibilities.
>
> GC shall be optional.
Please clarify for me what does mean "optional".
For example some library LibA rely on GC.
Another library LibB uses LibA internaly in few places.
LibB use handmade memory managament.
I'm use LibB in my program. I'm never create objects from LibA directly. Moreover I don't known anything about LibA.
Some questions:
- Will be GC runtime engine linked to my program?
- Will be GC engine recieve control in any point of my program even if I use LibB only on startup?
- My program is single threaded. How GC recieve control?
> Any good idea is first ridiculed, then rejected, then
> finally accepted.
May be.