what are the 2 forms of memory allocation
static and dynamic
what is static memory allocation
values for a fixed size
why is it important to have static memory allocation
so we can allocate space before running the code
what data types are stored in static
primitive data types
what are the primitive data types
(32 bits)
- ints
- floats
- char
- bool
(64 bits)
- double
what is dynamic memory allocation
values we don’t know exactly how much memory space we will need
what is stored in dynamic
objects
what are classed as objects
lists and strings
what is a list
object
what is a string
object
what is a int
primitive data type
what is a float
primitive data type
what is a char
primitive data type
what is a bool
primitive data type
what is a double
primitive data type
how many bits is a double
64
what do we use if we don’t know how much space objects will need
object reference (pointer)
what is the difference between an object and a variable
a variable is stored in the stack only
- most of the object is in the heap but the object reference is stored in the stack
what does an object reference point to
points to a memory location in the heap