Problems with GC, trees and array concatenation

Babele Dunnit babele.dunnit at gmail.com
Mon Jun 4 09:05:51 PDT 2007


Oskar Linde Wrote:

> The code is actually commented out on DMD:
> //foreach(inout byte b; cast(byte[])(p + size)[0..binsize[bin] - size]) 
> { b = 0; }
> 
> A patch that reverses that comment:
> 
> --- gcx.d       2007-06-04 16:47:02.354590379 +0200
> +++ gcx.d.new   2007-06-04 16:46:53.331933006 +0200
> @@ -297,7 +297,7 @@
>                  gcx.bucket[bin] = (cast(List *)p).next;
>                  //memset(p + size, 0, binsize[bin] - size);
>                  // 'inline' memset - Dave Fladebo.
> -               //foreach(inout byte b; cast(byte[])(p + 
> size)[0..binsize[bin] - size]) { b = 0; }
> +               foreach(inout byte b; cast(byte[])(p + 
> size)[0..binsize[bin] - size]) { b = 0; }
>                  //debug(PRINTF) printf("\tmalloc => %x\n", p);
>                  debug (MEMSTOMP) memset(p, 0xF0, size);
>              }
> 
> 
> Actually seems to remove the memory leak on Linux 1.014...
> 
> I am unable to test this on windows.

My test case seems to run rock-steady now under Windows. BTW, much faster (it does not reallocate!! :))

I'll let run the WHOLE BEAST tonight and tell you if it is still alive tomorrow...

great!

Grazie,
Bab

PS: Ok, but WHY is it commented out in actual Phobos distribution??




More information about the Digitalmars-d mailing list