[H-GEN] Which is better?

Trent Waddington s337240 at student.uq.edu.au
Thu Apr 29 22:17:38 EDT 2004


Russell Stuart wrote:

>
>On the issue the speed of manual versus automatic memory allocation, we
>continue to differ.  I continue to believe that while malloc and modern
>garbage collectors are comparable in resource requirements[1], the
>ability of the C/C++ program to do stack based allocation for most
>objects blows the program that is forced to mainly heap based allocation
>for everything.
>  
>

As someone who uses the Bohem garbage collector for C++ I can say that 
using it has in no significant way decreased the performance of our 
code.  I think garbage collection gets a bad rap from Java's use of it, 
specifically because of the stack/heap issue.  Essentially a programmer 
using C++ with garbage collection can specify that an object is short 
lived (by putting on it on the stack) whereas a programmer using Java 
cannot.  The solution to this is apparently generational garbage 
collection but this forces the memory management system to treat all 
objects like short lived objects until such a time that they are shown 
not to be (by hanging around for a while).

Trent




More information about the General mailing list