Download presentation
Presentation is loading. Please wait.
1
How Memory Leaks Work with Memory Diagram
CSCE 121
2
output identifier stack heap
3
output identifier stack heap
int getANumber() { int* z = new int(15); return *z; } int main() { int* k = new int(3); k = new int (7); int w = getANumber(); w main k identifier stack heap
4
output identifier stack heap
int getANumber() { int* z = new int(15); return *z; } int main() { int* k = new int(3); k = new int (7); int w = getANumber(); w main 3 k identifier stack heap
5
output identifier stack heap Memory Leak!
int getANumber() { int* z = new int(15); return *z; } int main() { int* k = new int(3); k = new int (7); int w = getANumber(); 7 w main 3 Memory Leak! k identifier stack heap
6
output identifier stack heap Memory Leak!
int getANumber() { int* z = new int(15); return *z; } int main() { int* k = new int(3); k = new int (7); int w = getANumber(); 15 getANumber z 7 w main 3 Memory Leak! k identifier stack heap
7
output identifier stack heap Memory Leak! Memory Leak!
int getANumber() { int* z = new int(15); return *z; } int main() { int* k = new int(3); k = new int (7); int w = getANumber(); Memory Leak! 15 getANumber z 15 7 w 15 main 3 Memory Leak! k identifier stack heap
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.