Buffer Overflow and Memory Leak

Memory Layout of a Process
Memory Layout of a Process

Buffer means a segment of memory used to store a specific size of data. It gets overflowed if the size of data is larger than the buffer size. It typically causes an exception subject to privilege escalation or returning to the code address in the stack. If input validation and exception handling routine are properly arranged, a buffer overflow can be effectively mitigated.

Memory leak is a common application problem. An application or process is allocated a limited memory size, aka heap, when loaded and launched by the OS. The process may request segments of memory but not return them to the OS. The available memory is running out in the end. The performance is getting worse, and it may result in a process crash. Modern runtime frameworks, e.g., .NET, JVM, provide garbage collection or reference counter to address this issue.

Leave a Reply