digitalmars.D.bugs - garbage collector bug (runtime access violation)
- Sean Kelly (20/20) Sep 16 2004 If I have time I'll try and debug this one myself, but I thought I'd pas...
If I have time I'll try and debug this one myself, but I thought I'd pass it on
anyway.
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" );
else
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;
D:\code\d\bugs>101_6
malloc failed
Error: Access Violation
Sep 16 2004








Sean Kelly <sean f4.ca>