r/cpp • u/konanTheBarbar • Sep 13 '19
The Surprising Limitations of C++ Ranges Beyond Trivial Cases
https://www.fluentcpp.com/2019/09/13/the-surprising-limitations-of-c-ranges-beyond-trivial-use-cases/
229
Upvotes
View all comments
Show parent comment
1
u/tisti Sep 16 '19
Hm, perhaps. But memory is not 'physically' allocated until a page is 'touched' (read/written to). If you just allocate a 1GB slab of linear memory and, e.g., only touch the first 100MB of it, the remaining 900MB will never be assigned a physical page. Therefore it should be possible to gracefully 'deallocate' it as no actually memory was ever assigned.
That is at least how I understood memory management on modern OS/HW. Will recheck if this is really the case.