Allocate much memory error


#1

I have a Geforce 8800 GT with 512 mb ram.

When i try to allocate exactly 386 mb of ram it crashes.

100663296 * 4 Bytes = 402653184 / (1024 * 1024) = 386 mb

When i try to allocate a little less for example 352 mb = 92274304 floats it works.


Verlinkungen - intern und extern
#2

Hello

There recently have been some threads about larger memory allocations (e.g. start with http://forum.byte-welt.de/showthread.php?t=4082 ).

You can try using

long total[] = { 0 };
long free[] = { 0 };
JCuda.cudaMemGetInfo(free, total);
System.out.println("Total "+total[0]+" free "+free[0]);

to see how much memory is still free before allocating, but note (as also pointed out in the other threads) that the maximum size for a single allocation might be smaller than the free memory (e.g. due to memory fragmentation).

bye
Marco