process stack done - debugging technique begins

This commit is contained in:
2025-10-19 09:41:53 +00:00
parent 2c7823e97a
commit dde42f2bac
2 changed files with 59 additions and 0 deletions

View File

@@ -131,3 +131,57 @@ Section 7: Foundation of Processes (Part A):
We can also use Address-sanitizers
* Stack Overflow:
~~~~~~~~~~~~~~~
When the size of any number of call stack crosses the
finite size of the allocated stack of the program, then
it leads to stack overflow.
+---------------------------+
| |
| stack | |
|---------------------------| |
| | |
| array[0] | |
| array[1] | |
| | | |
| | | |
| | | \|/
| | | *
| array[99....] |
|---------------------------|
| array[10....0] |
| heap |
| |
|---------------------------|
| |
| data |
| |
| |
|---------------------------|
| |
| .text |
| |
+---------------------------+
* Address Sanitizer:
~~~~~~~~~~~~~~~~~~
To know about potential memory leaks, we can enable stanitizer flag
Compiler flag:
-fsanitize=address
* To detect memory leak, we can use valgrind.
Command:
$valgrind --leak-check=full ./<program>
OR
$valgrind ./<program>