Getting core.exception.OutOfMemoryError error on allocating large arrays

John Colvin john.loughran.colvin at gmail.com
Sun Mar 3 07:52:48 PST 2013


On Sunday, 3 March 2013 at 14:05:02 UTC, Sparsh Mittal wrote:
> I am running
>
>
> enum long DIM = 1024L * 1024L * 1024L* 8L ;
> void main() {
>   auto signal = new double[DIM];
> }
>
>
> and getting core.exception.OutOfMemoryError error.  One option 
> is to use short/int, but I need to use double. Also, on using 
> large arrays, computer becomes slow.
>
> Is there no workaround at all, so that I can work on large 
> arrays? Please let me know.

Assuming double.sizeof==8 on your machine, You're requesting 
1024*1024*1024*8*8 bytes = 68GB, do you have that much RAM 
available?


More information about the Digitalmars-d-learn mailing list