Guarding from overruns
When you manage memory, mistakes can happen. Writes could happen outside of dynamic buffers or even beyond the limits of the stack or stack frame. These are very hard to track down, as they can happen with no noticeable error (write the same value that was there) or cause data corruption that crashes much further into execution, or in some completely unrelated area of the code (where it seems impossible), or crashes intermittently.
Most toolchains have debug features known as guards (or guard pages). These are extra padding around allocations or the stack. When writes occur in the guard, the application will crash or trigger a breakpoint. This way you’ll know right when the issue occurred, making it much easier and faster to track down and fix.
Have you ever used guard pages?