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

后端 未结 5 1892
感情败类
感情败类 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:38

    I had this problem too. I did a workaround where I chopped the array into sections (my biggest allowed array was float A_sub_matrix_20[62944560]). When I declared just one of these in main(), it seems to be put in RAM as I got a runtime exception as soon as main() starts. I was able to declare 20 buffers of that size as global variables which works (looks like in global form they are stored on the HDD - when I added A_sub_matrix_20[n] to the watch list in VisualStudio it gave a message "reading from file").

提交回复
热议问题