C ++ vector from memory

I have a very large vector (millions of records 1024 bytes each). I exceeded the maximum size of the vector (getting an exception due to poor memory). I am doing a recursive operation on an element vector that requires access to other elements in the vector. Operations must be completed quickly. I am trying to avoid writing to disk for speed reasons. Is there any other way to save this data that does not require writing to disk? If I need to write data to disk, what would be the most ideal way to do this>

edit some more details.

The operations that I perform in the dataset generate a row recursively based on other data points in the vector. Data is sorted when it is read. Datasets range from 50,000 to 50,000,000.

+5
source share
4 answers

The easiest way to solve this problem is to use STXXL . This is a reimplementation of STL for large structures that transparently write to disk when data will not fit into memory.

+9
source

Your problem cannot be resolved as indicated and clarified in the comments.

You requested a way to have a contiguous buffer in memory of 50,000,000 records of size 1024 on a 32-bit system.

A 32-bit system has only 4,294,967,296 bytes of address memory. You request 51200000000 bytes of address memory or 11.9 times the amount of address space on your system.

, , , , , .. , (, 8- Windows 4 ) - .

, , ", ".

+3

, , , std::vector reserve(), .

( ). , .

:

  • ( , )
  • .
  • , .
0

1 (1024 * 10 ^ 6 = 1 * 10 ^ 3 = 1 ). 32- 4 . , malloc() 1 . - . , msg, , .

-1

All Articles