MAT 21B Lecture Notes - Lecture 20: Null Pointer, Memory Leak, Static Variable

16 views2 pages
School
Department
Course
Professor
Lecture 20
Static memory allocation
Life time issue (see below for example correlation)
- Function cannot return a local variable
- When using local variable, all resources have to already exit before calling subfunction
- Global variable exist during the entire programs’ execution even when unused
Code lines examples:
Sizing issue
What if we need more ..
Requirement
- Lifetime independent from function
o Not in the stack
- Lifetime not necessarily for the entire
programs execution
o Not in data segment
Dynamic memory allocation
See powerpoint
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in
beigecamel74 and 41 others unlocked
MAT 21B Full Course Notes
83
MAT 21B Full Course Notes
Verified Note
83 documents

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