manual memory management

Mehrdad wfunction at hotmail.com
Wed Jan 9 02:21:28 PST 2013


On Wednesday, 9 January 2013 at 10:14:07 UTC, dennis luehring 
wrote:
> Am 09.01.2013 11:09, schrieb Mehrdad:
>> On Wednesday, 9 January 2013 at 10:07:42 UTC, deadalnix wrote:
>>> Reference counting tend to create big pauses when deallocating
>>> as objects tends to dies in group.
>>
>>
>>
>>
>> I don't get it... it's slower to deallocate a bunch of objects
>> together with refcounting than to deallocate all of them
>> individually over a longer period of time?
>>
>
> could be - think of an large hierarchy of objects which tends 
> to take some time to deconstruct ... a background gc could be 
> better for your application speed in this situation - by the 
> cost of smaller pause and more resource usage


Come to think of it, C++ allocators are meant for exactly this: 
throwing away an entire batch of objects in 1 go. Beats GCs any 
day.


>
> or better - what is the real reason for Java and C# for using 
> garbage collectors if ref-counting will be always better 
> (except cyclic stuff)?

Pretty sure the only reason C#/Java use a GC _is_ for cyclic 
stuff, and that's it.


If you have any other reasons please show me a benchmark that 
shows a GC being faster than the equivalent refcounted code (I've 
seen lots of talks in theory about how it _COULD_ be different 
but never seen any examples in practice; would love to see one).


More information about the Digitalmars-d mailing list