Memory Management Flashcards
1
Q
What keyword is responsible for allocating memory for new objects?
A
new
2
Q
Generally speaking, when does the garbage collector deallocate memory?
A
Whenever an object is no longer reachable
3
Q
When is a frame created?
A
Each time a method is called
4
Q
What is stored in the stack?
A
Primitive types and the memory address for reference types
5
Q
When is the heap created?
A
Whenever an application starts. There is only 1 heap per application
6
Q
What is stored in the heap?
A
The actual objects of an application (not their memory address like in stacks)