Heap-Stack Diagram: Sanzheng Qiao
Heap-Stack Diagram: Sanzheng Qiao
Heap-stack Diagram
Sanzheng Qiao
McMaster University
November, 2011
Example
Sizes of Objects
Outline
Sizes of Objects
Example
Example
Sizes of Objects
Sizes of objects
Example
Sizes of Objects
Sizes of objects
Example
Sizes of Objects
Outline
Sizes of Objects
Example
Example
Sizes of Objects
Example
Sizes of Objects
Example
Sizes of Objects
Outline
Sizes of Objects
Example
Example
Sizes of Objects
Example
int main() {
pointT pt;
pt.x = 1;
pt.y = 2;
int *array = new int[3];
Nonsense(array, pt);
return 0;
}
void Nonsense(int list[], pointT &ptr) {
list[1] = ptr->x;
}
heap
stack
Example
Sizes of Objects
Example
Example
int main()
pointT
pt.x =
pt.y =
{
pt;
1;
2;
<----- diagram
heap
stack
pt
1
2
FFF4
FFF8
Sizes of Objects
Example
Example
int main() {
pointT pt;
pt.x = 1;
pt.y = 2;
int *array = new int[3];
<----- diagram
Nonsense(array, pt);
return 0;
}
void Nonsense(int list[], pointT &ptr) {
list[1] = ptr->x;
}
heap
stack
1000
1004
array
1000
FFF0
pt
FFF4
FFF8
Sizes of Objects
Example
int main() {
pointT pt;
pt.x = 1;
pt.y = 2;
int *array = new int[3];
Nonsense(array, pt);
return 0;
}
void Nonsense(int list[], pointT &ptr) {
list[1] = ptr->x;
<----- diagram
}
heap
stack
1000
ptr
FFF4
FFE4
1004
list
1000
FFE8
array
1000
FFF0
pt
FFF4
FFF8
Example