FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is there a GC'd malloc alternative?

 
Post new topic   Reply to topic     Forum Index -> General
View previous topic :: View next topic  
Author Message
0ffh



Joined: 14 Feb 2007
Posts: 1

PostPosted: Mon Feb 19, 2007 2:29 pm    Post subject: Is there a GC'd malloc alternative? Reply with quote

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 mem?

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.





[/i]
Back to top
View user's profile Send private message
Brian



Joined: 08 Mar 2007
Posts: 13
Location: Talent, OR

PostPosted: Fri Mar 23, 2007 11:23 am    Post subject: RE: Is there a GC'd malloc alternative? Reply with quote

Hope you've found the answer to this by now, but there's one in Tango. I'm using it in my project and it seems to work pretty well.

Brian
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Fri Mar 23, 2007 2:04 pm    Post subject: Reply with quote

Yup, Tango has gc.malloc(), gc.calloc(), and gc.realloc(). If you're using Phobos, the equivalent is "new void[x]" for memory containing pointers or "new byte[x]" for memory without pointers.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> General All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group