Re:How to make smaller C and C++ binaries
by DustinGadal on Monday May 08, 2023 @06:58AM
(#35860211)
On platforms that allow overcommitment, you can guarantee your commit charge is physically backed by writing to each page in a memory pool at allocation time (probably at application startup, or at the end of the main loop), then allocating out of that pool.
Using memory that's been allocated but not committed seems like a recipe for disaster.
You're just going to end up with an insane amount of error handling only to discover that in the real world, there's likely nothing you can really do anyway.