News for hackers. Stuff that matters.
Re:How fast can you allocate a large block of memory in C++? by Const-me on Thursday January 16, 2020 @08:14AM (#22064157)
The OP should have added “Linux” somewhere in the title.

Here on Windows, the OS doesn’t overcommit and the first new[] call actually allocates these pages (possibly in a page file).

Also, if the requested size is large enough (>512kb on Win32, >1MB on Win64), the OS guarantees zero initialization despite C++ doesn’t: https://docs.microsoft.com/en-us/windows/win32/api/memoryapi...

Re:How fast can you allocate a large block of memory in C++? by wbkang on Thursday January 16, 2020 @09:04AM (#22064570)
Even on Windows the pagefile space is taken but it doesn't have to write to disk right? They can zero on first read.