D

dsimcha dsimcha at yahoo.com
Sat Nov 22 21:25:35 PST 2008


== Quote from Tony (tonytech08 at gmail.com)'s article
> So I have heard: that one can drop the GC and program correctly (hehe). But
> if that's one's preferred style, that kinda means C++ is the tool of choice,
> huh? (Not to belabor the point though).
> Tony

Actually, there is an advantage to this.  GC makes language and library design a
lot more flexible, and C++'s opt-in design hinders this.  At the same time, there
are some use cases for which garbage collection is slow, such as when a function
requires O(N) scratch space to perform a calculation on an object that can
reasonably be arbitrarily large.  In these cases, where objects are large and
lifecycles are trivial, it can be a worthwhile optimization to delete this scratch
space manually, even though you simply let the GC manage the vast majority of your
memory.



More information about the Digitalmars-d mailing list