Very large array on the heap (Visual C++)

后端 未结 6 793
一向
一向 2021-01-22 21:00

I hope some one can help me, i\'m trying to create an int[400000000] (400 millions) array on my application using visual c++ 2010 but it generates an overflow error The same cod

6条回答
  •  攒了一身酷
    2021-01-22 22:05

    Perhaps sparse matrices are of use in your application. This concept is used when dealing with big matrices which have a lot of 0 entries, which can be the case in quite a lot of applications.

    And by the way, you do not gain anything by storing such a huge amount of data on the heap. Consider, that your CPU cache has perhaps 12 MB! At least use some intelligent dynamic memory allocation mechanism.

提交回复
热议问题