Create too large array in C++, how to solve?

后端 未结 5 1883
感情败类
感情败类 2021-02-03 12:17

Recently, I work in C++ and I have to create a array[60.000][60.000]. However, i cannot create this array because it\'s too large. I tried float **array

5条回答
  •  迷失自我
    2021-02-03 12:29

    Does "60.000" actually mean "60000"? If so, the size of the required memory is 60000 * 60000 * sizeof(float), which is roughly 13.4 GB. A typical 32-bit process is limited to only 2 GB, so it is clear why it doesn't fit.

    On the other hand, I don't see why you shouldn't be able to fit that into a 64-bit process, assuming your machine has enough RAM.

提交回复
热议问题