c - Limit on memory allocation in windows + am I calculating this properly? -



c - Limit on memory allocation in windows + am I calculating this properly? -

i'm writing programme requires lot of memory (large graph analysis).

currently there 2 main info structures in programme (taking of memory). these are:

a n*n matrix of type int ** and array of length n, type node *

node, in case, struct containing 2 ints (sizeof(node) = 8)

the biggest value n can run code on 22900, doing bit of calculation get:

22900*22900 * sizeof(int) * 8 + 22900 * sizeof(node) = 16782591360 bits

this 1.95375077 gigabytes.

so question 1: calculating memory usage these 2 info structures properly? , 2: there 2gb memory allocation limit on windows. if so, how can around it?

for farther information, on 64bit windows 7 machine compiling gcc, 4gb ram ~3gb of free ram @ time of running.

thanks.

you aren't calculating correctly. first, there no reason multiply 8. quantum of allocation in c byte, not bit. second, neglect pointer array implements first dimension of matrix. so:

22900 * sizeof(int*) + 22900*22900*sizeof(int) + 22900*sizeof(node) = 2097914800 bytes

as useful advice, i'll leave (already posted) other answer.

c windows memory-management limit

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -