memory allocation Flashcards

(19 cards)

1
Q

what are the 2 forms of memory allocation

A

static and dynamic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is static memory allocation

A

values for a fixed size

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

why is it important to have static memory allocation

A

so we can allocate space before running the code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what data types are stored in static

A

primitive data types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what are the primitive data types

A

(32 bits)
- ints
- floats
- char
- bool
(64 bits)
- double

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is dynamic memory allocation

A

values we don’t know exactly how much memory space we will need

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is stored in dynamic

A

objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what are classed as objects

A

lists and strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is a list

A

object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is a string

A

object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is a int

A

primitive data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is a float

A

primitive data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is a char

A

primitive data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is a bool

A

primitive data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what is a double

A

primitive data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

how many bits is a double

17
Q

what do we use if we don’t know how much space objects will need

A

object reference (pointer)

18
Q

what is the difference between an object and a variable

A

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

19
Q

what does an object reference point to

A

points to a memory location in the heap