Getting core.exception.OutOfMemoryError error on allocating large arrays

John Colvin john.loughran.colvin at gmail.com
Sun Aug 18 06:13:23 PDT 2013


On Sunday, 18 August 2013 at 12:40:42 UTC, zorran wrote:
>
>> 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
> 		

Well that proves malloc is actually allocating the memory.

I'd say file a bug report. This should definitely work.


More information about the Digitalmars-d-learn mailing list