Mohsina_Shaikh's blog

By Mohsina_Shaikh, history, 20 months ago, In English

Can anyone please explain why my program crashes without mentioning any error If I try to create vector of size 10^9 in c++.Anyway If I decrease the size of vector let's suppose to something like 10^7 and 10^6 it works fine

  • Vote: I like it
  • -4
  • Vote: I do not like it

»
20 months ago, # |
  Vote: I like it 0 Vote: I do not like it

1 billion of int in vector would eat 4GB of memory. It's too much, if you have less than 4GB of free RAM.

»
20 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Vector max size is 1073741823, close to 10^9, but usual maximum that will pass is 10^7.