C++ and D @ stackoverflow
Walter Bright
newshound1 at digitalmars.com
Sat Jun 12 14:49:33 PDT 2010
Brad Roberts wrote:
> On 6/12/2010 1:53 PM, Walter Bright wrote:
>> Brad Roberts wrote:
>>> Or, even better:
>>>
>>> import core.memory;
>>>
>>> void* m = GC.malloc(size);
>> The idea was to not use the gc, instead explicitly manage the block of
>> memory.
>
> Actually, the point was to get precise lifetime of memory, right? That's where
> the refcounting comes in. That the memory comes from the gc doesn't mean it
> can't be refcounted to achieve that. It does mean that it's needlessly scanned
> as part of any collection cycles. It's not too hard to suggest that it's worth
> doing to find refcount cycles that should have gone away.
>
You're right, but enormous effort has gone into improving malloc/free, why not
take advantage of it? It also serves as a demonstration for how to do it.
More information about the Digitalmars-d
mailing list