Defining a large vector

Barry Schwarz 1,851 Reputation points
2021-11-13T23:50:28.803+00:00

I am trying to define a vector with 250 million long long int elements suing

vector<long long int> primes(250000000);

When I step through the definition, it fails with an allocation error. My previous effort with 200 million elements succeeded and max_size() returned a value of 536,870,911.

I attempted to update the four stack and heap parameters, which defaulted to blank, without success.

A Google search did not turn up anything I could recognize as useful.

I was successful in defining the vector with 240 million elements which will serve until I fill up my database, if ever. But I would like to learn the correct procedure for the next itme I need to do this.

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,511 questions
{count} votes

0 additional answers

Sort by: Most helpful