Getting core.exception.OutOfMemoryError error on allocating large arrays

zorran zorran at tut.by
Sun Aug 18 05:40:40 PDT 2013


> Interesting... What happens if you use core.memory.GC.malloc?

enum long size= 1300_000_000;		
byte * p = cast(byte *) malloc(size);
	
for(int i=0; i<size; i++)
	p[i]=1;

ulong sum=0;	
for(int i=0; i<size; i++)
    sum += p[i];		
		
writef("%d ", sum); // here written 1300000000
		


More information about the Digitalmars-d-learn mailing list