Re: GC.calloc(), then what?

2014-06-28 Thread safety0ff via Digitalmars-d-learn
On Friday, 27 June 2014 at 23:26:55 UTC, Ali Çehreli wrote: I appreciated your answers, which were very helpful. What I meant was, I was partially enlightened but still had some questions. I am in much better shape now. :) Yea, I understood what you meant. :)

GC.calloc(), then what?

2014-06-27 Thread Ali Çehreli via Digitalmars-d-learn
1) After allocating memory by GC.calloc() to place objects on it, what else should one do? In what situations does one need to call addRoot() or addRange()? 2) Does the answer to the previous question differ for struct objects versus class objects? 3) Is there a difference between

Re: GC.calloc(), then what?

2014-06-27 Thread safety0ff via Digitalmars-d-learn
On Friday, 27 June 2014 at 07:03:28 UTC, Ali Çehreli wrote: 1) After allocating memory by GC.calloc() to place objects on it, what else should one do? Use std.conv.emplace. In what situations does one need to call addRoot() or addRange()? Add root creates an internal reference within the

Re: GC.calloc(), then what?

2014-06-27 Thread safety0ff via Digitalmars-d-learn
I realize that my answer isn't completely clear in some cases, if you still have questions, ask away.

Re: GC.calloc(), then what?

2014-06-27 Thread Ali Çehreli via Digitalmars-d-learn
On 06/27/2014 12:53 AM, safety0ff wrote: I realize that my answer isn't completely clear in some cases, if you still have questions, ask away. Done! That's why we are here anyway. :p Ali

Re: GC.calloc(), then what?

2014-06-27 Thread Ali Çehreli via Digitalmars-d-learn
Thank you for your responses. I am partly enlightened. :p On 06/27/2014 12:34 AM, safety0ff wrote: On Friday, 27 June 2014 at 07:03:28 UTC, Ali Çehreli wrote: 1) After allocating memory by GC.calloc() to place objects on it, what else should one do? Use std.conv.emplace. That much I know.

Re: GC.calloc(), then what?

2014-06-27 Thread safety0ff via Digitalmars-d-learn
On Friday, 27 June 2014 at 08:17:07 UTC, Ali Çehreli wrote: Thank you for your responses. I am partly enlightened. :p I know you're a knowledgeable person in the D community, I may have stated many things you already knew, but I tried to answer the questions as-is. On 06/27/2014 12:34

Re: GC.calloc(), then what?

2014-06-27 Thread safety0ff via Digitalmars-d-learn
On Friday, 27 June 2014 at 08:17:07 UTC, Ali Çehreli wrote: So, the GC's default behavior is to scan the memory, necessitating clearing the contents? That seems to make GC.malloc() behave the same as GC.calloc() by default, doesn't it? Yes. compare:

Re: GC.calloc(), then what?

2014-06-27 Thread safety0ff via Digitalmars-d-learn
On Friday, 27 June 2014 at 09:20:53 UTC, safety0ff wrote: Yes. compare: https://github.com/D-Programming-Language/druntime/blob/master/src/gc/gc.d#L543 to: https://github.com/D-Programming-Language/druntime/blob/master/src/gc/gc.d#L419 Actually, I just realized that I was wrong in saying the

Re: GC.calloc(), then what?

2014-06-27 Thread eles via Digitalmars-d-learn
On Friday, 27 June 2014 at 08:17:07 UTC, Ali Çehreli wrote: Thank you for your responses. I am partly enlightened. :p On 06/27/2014 12:34 AM, safety0ff wrote: On Friday, 27 June 2014 at 07:03:28 UTC, Ali Çehreli wrote: But addRange doesn't seem to make sense for stdlib.malloc'ed memory,

Re: GC.calloc(), then what?

2014-06-27 Thread Sean Kelly via Digitalmars-d-learn
On Friday, 27 June 2014 at 07:34:55 UTC, safety0ff wrote: On Friday, 27 June 2014 at 07:03:28 UTC, Ali Çehreli wrote: 1) After allocating memory by GC.calloc() to place objects on it, what else should one do? Use std.conv.emplace. And possibly set BlkInfo flags to indicate whether the block

Re: GC.calloc(), then what?

2014-06-27 Thread Ali Çehreli via Digitalmars-d-learn
On 06/27/2014 01:49 AM, safety0ff wrote: On Friday, 27 June 2014 at 08:17:07 UTC, Ali Çehreli wrote: Thank you for your responses. I am partly enlightened. :p I know you're a knowledgeable person in the D community, I may have stated many things you already knew, but I tried to answer the