gc vs explicit
xxxxxx at xxx.xx
Thu Dec 7 22:06:28 PST 2006
Walter Bright wrote:
> zz wrote:
>> From my point of view these tests are not really nessesary on my side
>> since I still continue using D and I belive that someday the memory
>> stuff will be optimized.
> One thing that is happening is that the C++ code allocates memory, it
> never frees it. The same with the D code.
> What happens with a garbage collector is it gets new chunks of memory
> from the operating system as it needs it. But before it does, it runs a
> collection cycle.
> So in the D version, it will be running probably several collection
> cycles (accomplishing nothing), while the C++ version does not. This
> will make the gc version slower.
> To get better numbers, one can add calls to gc.disable() and gc.enable()
> to tell the gc that there is no point to running a collection cycle for
> this section of code.
Has anyone looked into analysis of D code to automatically insert
frees/deletes in pertinent places, so that GC is required less often?
The good thing about allowing this sort of analysis is that no harm is
done if you don't find anything (since GC will still guarantee it is
eventually collected), but it could yield benefits in certain places
where deterministic deletion is possible.
More information about the Digitalmars-d