By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,948 Members | 1,192 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,948 IT Pros & Developers. It's quick & easy.

Re: Garbage collection in C++

P: n/a
On Nov 18, 5:30 pm, "Chris M. Thomasson" <n...@spam.invalidwrote:
"James Kanze" <james.ka...@gmail.comwrote in message
news:10**********************************@a26g2000 prf.googlegroups.com...
On Nov 18, 4:15 pm, "Chris M. Thomasson" <n...@spam.invalid>
wrote:
In other words, extra work. That's exactly what Matthias was
arguing against.
why free the memory when you can reuse some of it?
Why do extra work when you don't have to?
You can do this in a GC environment, but it requires you to
traverse a "portion" of the tree.
A node cache reduces the number of calls to `new'; IMHO, this
is a good thing.
The best thing would be that the program would use no memory,
run in 0 time, and be ready last week, with no programmers
having worked on it. It's not going to happen, so we have to
compromize. Reducing the number of calls to new might be a good
thing (although it's not been proven), but is it worth more
money than it costs to implement it?
Also, why not use a __partitioned__ region allocation
algorithm for the nodes in different trees? That way, a single
call to `std::free()' will promptly destroy all the memory
which makes up a given trees nodes in a single operation.
AFAICT, that's more efficient than a GC.
For the programmer?
For the program.
For what aspect of the program? Development cost?
Maintainability?
Since when is writing additional code more efficient.
Its worth it that extra work increases the scalability,
throughput and performance of a program.
If scalability, throughput and performance are not adequate
otherwise, then you have to do something. There are certainly
some applications where garbage collection has no place. But
they're not typical; most of the time, garbage collection will
save programmer time (and thus money) at a negligible cost
elsewhere.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Nov 18 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.