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

后端 未结 10 809
面向向阳花
面向向阳花 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:11

    The advantage of memory mapped files is that you can open a file much bigger than 4Gb (almost infinite on NTFS!) and have multiple <4Gb memory windows into it.
    It's much more efficent than opening a file and reading it into memory,on most operating systems it uses the built-in paging support.

提交回复
热议问题