Defining a large vector

Barry Schwarz 666 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.
2,635 questions
{count} votes

Accepted answer
  1. Barry Schwarz 666 Reputation points
    2021-11-14T10:31:31.493+00:00

    Using the Configuration Manager to target x64 instead of Win32 solved the problem

    Thanks all

    No comments

0 additional answers

Sort by: Most helpful