Is it possible to allocate large amount of virtual memory in linux?
问题 It would be efficient for some purposes to allocate a huge amount of virtual space, and page in only pages that are accessed. Allocating a large amount of memory is instantaneous and does not actually grab pages: char* p = new char[1024*1024*1024*256]; Ok, the above was wrong as pointed out because it's a 32 bit number. I expect that new is calling malloc which calls sbrk, and that when I access a location 4Gb beyond the start, it tries to extend the task memory by that much? Here is the full