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

后端 未结 6 787
一向
一向 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 21:49

    Does the whole array really needs to be allocated ? do you really use the whole array ? Is it an array with lots of 0 ? if it is the case, then the fact that it works better on linux can be explained.

    In that case using a sparse array might be more appropriate. Using an existing sparse array implementation would reduce the memory footprint and maybe allow faster computation.

提交回复
热议问题