Can you allocate a very large single chunk of memory ( > 4GB ) in c or c++?

后端 未结 10 810
面向向阳花
面向向阳花 2020-12-02 10:46

With very large amounts of ram these days I was wondering, it is possible to allocate a single chunk of memory that is larger than 4GB? Or would I need to allocate a bunch o

10条回答
  •  情话喂你
    2020-12-02 11:27

    Short answer: Not likely

    In order for this to work, you absolutely would have to use a 64-bit processor. Secondly, it would depend on the Operating System support for allocating more than 4G of RAM to a single process.

    In theory, it would be possible, but you would have to read the documentation for the memory allocator. You would also be more susceptible to memory fragmentation issues.

    There is good information on Windows memory management.

提交回复
热议问题