COMPSCI 61C Lecture Notes - Lecture 6: Call Stack, Uninitialized Variable, C Dynamic Memory Allocation

53 views3 pages

Document Summary

To simplify discussion, we assume one program runs at a time with access to all of memory. Later, we"ll discuss virtual memory, which lets multiple programs all run at the same time each thinking they own all the memory. If declared outside a function, allocated in static storage. If declared inside function, allocated on the stack and freed when function returns main(cid:383)(cid:384) is treated like a function. For both types of memory, management is automatic! Every time a function is called, a new frame is allocated on the stack. Stack frame includes: return address (who called me?) arguments space for local variables. Use contiguous blocks of memory; stack pointer indicates start of stack frame. When function ends, stack pointer moves up; frees memory for future stack frames. Check for it) additional control information (including size) stored in the heap for each allocated block.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents