Is there a GC'd malloc alternative?
0ffh
spam at frankhirsch.net
Mon Feb 19 13:14:56 PST 2007
Johan Granberg wrote:
> 0ffh wrote:
>
>> I just wonder if there is no library function that
>> works like 'malloc' but in garbage collected memory?
>> [...]
>> p.s.
>> I am probably not looking for the 'new' operator,
>> [...]
>
> are you sure about the new thing. I think that this code would work.
>
> new void[SIZE];
>
> where SIZE is an integer representing how large chunk of memory you want to
> reserve.
>
> ps. this newsgroup is all but abandoned use the digitalmars.D instead.
Well, thanks, "void d[]=new void[100];" seems to compile fine.
Now I just wonder how many bytes 100 voids weight? :-)
Do you think it would be evil to steal the pointer out of the
array, because I'd really like to get a pointer as a result?
Cheers, 0ffh
More information about the Digitalmars-d
mailing list