GC, the simple solution
Sean Kelly
sean at f4.ca
Thu Jun 8 23:53:31 PDT 2006
Derek Parnell wrote:
> On Thu, 08 Jun 2006 22:18:24 -0700, Walter Bright wrote:
>
>
>> The approach most real time programmers use to deal with this is to
>> preallocate all needed data before entering the real time section, and
>> the real time section does no malloc's or free's.
>>
>> Also, you can use malloc and free in D, in exactly the same way you
>> would in C.
>
> It seems obvious that if one doesn't want the Garbage Collector to collect
> garbage, one doesn't create any garbage for it to collect. ;-)
This gets sticky if one wants to use strings in D though, as there's no
real way to make them work outside of the garbage collector mechanism.
Sure we could use C-style pointers, but it's not a terribly attractive
option. I suppose the alternative would be a class with a custom
allocator method.
Sean
More information about the Digitalmars-d
mailing list