CS 112
Lecture 19
References in Java
- Student presentations of independently researched Java topic.
- Dynamic memory allocation in Java:
- What new does
- Allocation in the heap
- Garbage collection
- Issues in other languages and discussion of why these problems do not appear in Java (or do they?):
- deallocation of memory and deconstructors (in C/C++)
- dangling pointers
- memory leaks
- Static variables and methods
- Summary of memory allocation for variables:
- Function parameters and local variables: on the stack. Basic types and references only.
- Object variables allocated with new: on the heap. All class variables (except static) are part of the space allocated for
each object.
- Static variables in classes: allocated statically (not at run time), only once.
- Summary of memory allocation types: static (determined at compilation time) and dynamic (determined at run time).
Practicing linked list access old exams
Old exam 1 and
Old exam 2.
Ileana Streinu