www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - garbage collector bug (runtime access violation)

If I have time I'll try and debug this one myself, but I thought I'd pass it on

D:\code\d\bugs>type 101_6.d
// this function demonstrates a bug with the garbage collector

import std.c.stdlib;

void main()
const size_t size = 999999999;
long* cbuf = cast(long*) malloc( size );

if( cbuf == null )
printf( "malloc failed\n" );
free( cbuf );

long[] dbuf = new long[size];
D:\code\d\bugs>dmd 101_6.d
D:\bin\dmd\bin\..\..\dm\bin\link.exe 101_6,,,user32+kernel32/noi;

malloc failed
Error: Access Violation
Sep 16 2004