4 ms·
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 (po
by Const-me 7y ago
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/nf-memoryapi-virtualalloc https://docs.microsoft.com/en-us/windows/win32/api/memoryapi...
- wbkang 7y agoEven on Windows the pagefile space is taken but it doesn't have to write to disk right? They can zero on first read.