storing objects, stack and heap Flashcards

(27 cards)

1
Q

what is a process

A

an instance of a program being executed

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

what does contiguous mean

A

together

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

what does a process use

A

each process may use groups of locations that are not contiguous

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

what is each process allocated

A

each process is allocated its own portion of main memory by the operating system

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

where are global variables stored

A

data

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

what is stored in data

A

global variables

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

what is stored in stack

A

local variables, return addresses and parameter values

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

what is stored in heap

A

dynamically allocated objects (strings, arrays, lists)

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

what is the zone in between the stack and heap sections

A

the buffer

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

what is stored in text

A

code eg visual studio code

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

what are the 2 purposes of the call stack

A
  • keep track of which line in the code to return to when a subroutine call terminates
  • to keep track of the values of local variables and parameters specific to that subroutine call
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is step 1 of storing objects

A

the location of the first item is put into the stack

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

what is step 2 of storing objects

A

that location in the heap is found, along with the next one. They come as a pair

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

what is step 3 of storing objects

A

the first location is assigned a value
the second is left empty so it can be used to connect with another location

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

what is step 4 of storing objects

A

as more numbers are added, more locations in the heap are linked and filled

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

what is the role of the second linking location in the heap

A

its address registry links to others

17
Q

where are variables stored

A

the stack only

18
Q

where are objects stored

19
Q

where is object reference stored

20
Q

what is the heap

A

relatively unstructured pool of memory ready to use for storing data for objects

21
Q

what happens when a new object is created in the heap

A

the heap grows in size

22
Q

what happens when all references to an object no longer exists

A

the memory will be freed back to the unallocated pool
heap shrinks

23
Q

what causes the heap to shrink

A

when all references to an object no longer exists
that memory will be freed back to the unallocated pool

24
Q

what causes the memory to be freed back to the unallocated pool

A

when all references to an object no longer exists

25
what causes a heap to grow in size
when a new object is created
26
what happens to the reference when a new object is created
the reference to that object s returned in code
27
where is the reference stored
in the call stack