www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Precise garbage collection

reply "Borneq" <borneq antyspam.hidden.pl> writes:
Conservative garbage collection causes memory leaks. In D is added:
http://d.puremagic.com/issues/show_bug.cgi?id=3463
This is semi precise - only the heap have type information. What type 
information has fully precise? Semi precise causes memory leaks?
This above patch is applied in official version D ? 
Aug 15 2010
parent reply Leandro Lucarella <luca llucax.com.ar> writes:
Borneq, el 16 de agosto a las 07:53 me escribiste:
 Conservative garbage collection causes memory leaks. In D is added:
 http://d.puremagic.com/issues/show_bug.cgi?id=3463
 This is semi precise - only the heap have type information. What
 type information has fully precise? Semi precise causes memory
 leaks?

Unfortunately full preciseness is not possible in D, due to unions mostly. Having a precise stack would be very hard (and probably costly, so not very suitable for D) but having a precise static data (and a more accurate one) maybe is possible, see bug 4650: http://d.puremagic.com/issues/show_bug.cgi?id=4650 Memory leaks will always be possible in D, but I think if the stack is the only part that should be scanned in conservative mode, they can greatly be reduced.
 This above patch is applied in official version D ?

Not yet, vote up! =) -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- Demasiado lento para una estrella fugaz Demasiado limpio para lo que vos acostumbras Demasiado claro para tanta oscuridad Demasiados sueƱos, poca realidad
Aug 16 2010
parent bearophile <bearophileHUGS lycos.com> writes:
Leandro Lucarella:
 Unfortunately full preciseness is not possible in D, due to unions mostly.

But unions are not so common in D code.
  Having a precise stack would be very hard (and probably costly,
 so not very suitable for D)

LLVM contains tools to implement precise stack tracing. Once some application is available for D2, and once a LLVM-based D2 compiler exists, I think those tools can be used to perform experiments, to see how much costly they are, how much precision they give, etc (even if they are not present with DMD).
 This above patch is applied in official version D ?

With the current "speed" it may take two years :-) You probably have to wait. Bye, bearophile
Aug 16 2010