Is there a GC'd malloc alternative?

Johan Granberg lijat.meREM at OVE.gmail.com
Mon Feb 19 12:57:54 PST 2007


0ffh wrote:

> 
> Hi, I'm new to D but got into it pretty quickly...
> it's heaven for a lazy old C coder! }:->>>
> 
> I just wonder if there is no library function that
> works like 'malloc' but in garbage collected memory?
> 
> Happy hacking, 0ffh
> 
> p.s.
> I am probably not looking for the 'new' operator,
> as 'new' seems to take only certain types as
> "argument", not the size of the requested memory
> chunk, as does 'malloc'.

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.



More information about the Digitalmars-d mailing list