www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D runtime Garbage Collector details

reply "Vadim" <vadim.goryunov gmail.com> writes:
I am looking for the details on D Garbage Collection 
implementation. I will much appreciate if someone suggests the 
answers or give some links to existing documentation clarifying 
the following points:

1. Is it Mark-n-Sweep or copy or generational collector or simple 
reference counting? Or anything else? Any documentation on this 
would be very helpful

2. Sun/Oracle JVM publishes a number of counters in shared memory 
so that user may easily monitor the memory usage and the GC 
statistics real-time without affecting the application (and 
without modifying the application). Is there anything similar for 
D GC?

3. Is there any performance tests of D GC efficiency? Is it 
possible to write GC-predictable code (without manual 
allocate/free) or at least do something like System.gc()?
Feb 23 2012
next sibling parent James Miller <james aatch.net> writes:
On 24 February 2012 12:49, Vadim <vadim.goryunov gmail.com> wrote:
 I am looking for the details on D Garbage Collection implementation. I will
 much appreciate if someone suggests the answers or give some links to
 existing documentation clarifying the following points:

 1. Is it Mark-n-Sweep or copy or generational collector or simple reference
 counting? Or anything else? Any documentation on this would be very helpful

 2. Sun/Oracle JVM publishes a number of counters in shared memory so that
 user may easily monitor the memory usage and the GC statistics real-time
 without affecting the application (and without modifying the application).
 Is there anything similar for D GC?

 3. Is there any performance tests of D GC efficiency? Is it possible to
 write GC-predictable code (without manual allocate/free) or at least do
 something like System.gc()?

I don't know the answers to 1 or 2, but I know that there is a GC class with a bunch of methods on it for controlling the GC, including enabling and disabling it and getting GC-allocated memory. Whether that helps you write GC predictable code - I don't know, garbage collection is mostly a black art to me :-) -- James Miller
Feb 23 2012
prev sibling next sibling parent Kevin Cox <kevincox.ca gmail.com> writes:
--0015175cfc86f0bedb04b9ad43fd
Content-Type: text/plain; charset=UTF-8

On Feb 23, 2012 6:50 PM, "Vadim" <vadim.goryunov gmail.com> wrote:
 I am looking for the details on D Garbage Collection implementation. I

existing documentation clarifying the following points:
 1. Is it Mark-n-Sweep or copy or generational collector or simple

very helpful
 2. Sun/Oracle JVM publishes a number of counters in shared memory so that

without affecting the application (and without modifying the application). Is there anything similar for D GC?
 3. Is there any performance tests of D GC efficiency? Is it possible to

something like System.gc There is quite a lot of info in the mailing list. Off of the top of my head I know it is a mark and sweep. There is someone who did their Phd on GC in D and he did a fairly good analysis of the current situation. And as the fellow before me said, there is a garbage collector control. --0015175cfc86f0bedb04b9ad43fd Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <p><br> On Feb 23, 2012 6:50 PM, &quot;Vadim&quot; &lt;<a href=3D"mailto:vadim.gory= unov gmail.com">vadim.goryunov gmail.com</a>&gt; wrote:<br> &gt;<br> &gt; I am looking for the details on D Garbage Collection implementation. I= will much appreciate if someone suggests the answers or give some links to= existing documentation clarifying the following points:<br> &gt;<br> &gt; 1. Is it Mark-n-Sweep or copy or generational collector or simple refe= rence counting? Or anything else? Any documentation on this would be very h= elpful<br> &gt;<br> &gt; 2. Sun/Oracle JVM publishes a number of counters in shared memory so t= hat user may easily monitor the memory usage and the GC statistics real-tim= e without affecting the application (and without modifying the application)= . Is there anything similar for D GC?<br> &gt;<br> &gt; 3. Is there any performance tests of D GC efficiency? Is it possible t= o write GC-predictable code (without manual allocate/free) or at least do s= omething like System.gc</p> <p>There is quite a lot of info in the mailing list.=C2=A0 Off of the top o= f my head I know it is a mark and sweep.=C2=A0 There is someone who did the= ir Phd on GC in D and he did a fairly good analysis of the current situatio= n.</p> <p>And as the fellow before me said, there is a garbage collector control.<= /p> --0015175cfc86f0bedb04b9ad43fd--
Feb 23 2012
prev sibling parent deadalnix <deadalnix gmail.com> writes:
Le 24/02/2012 00:49, Vadim a écrit :
 I am looking for the details on D Garbage Collection implementation. I
 will much appreciate if someone suggests the answers or give some links
 to existing documentation clarifying the following points:

 1. Is it Mark-n-Sweep or copy or generational collector or simple
 reference counting? Or anything else? Any documentation on this would be
 very helpful

Mark and sweep, but do not copy and isn't generationnal.
 2. Sun/Oracle JVM publishes a number of counters in shared memory so
 that user may easily monitor the memory usage and the GC statistics
 real-time without affecting the application (and without modifying the
 application). Is there anything similar for D GC?

You should ask the system for thoses infos.
 3. Is there any performance tests of D GC efficiency? Is it possible to
 write GC-predictable code (without manual allocate/free) or at least do
 something like System.gc()?

Its performance are quite poor ATM, it is getting better, but still not as effeiscient as java's GC for example. You could disable it using the class GC on critical period of time, so you'd know when it run and when it cannot trigger itself. D allow also to manage memory manually, and if you don't generate garbage, GC will not trigger.
Feb 24 2012