-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathUntitled Document 1
38 lines (29 loc) · 925 Bytes
/
Untitled Document 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Section 3 - Memory Management
OS Allocates four areas of memory on program startup
Code Segment
Program Instructions
Address of functions
Data Segment
Global Memory
Global Variables
Static Variables
Literals
Notation for representing fixed value. (ints, chars etc.)
Function Call Stack
Purpose
Manages the order of the function calls, and stores local variables
Local Data
Heap (Part of Data Segment)
Dynamically allocated memory
void push(eIOfseoifj, esofihesofhies){
if( data->size + 1 > data->capacity){
ElementType **temp = data -> elements
data->elements = (ElementType **) malloc (2* data->capacity * sizeof(ElementType *))
int i;
for(i = 0 ; i < size ; i++){
data->elements[i] = temp[i]
}
data->elements[data->size++] = element;
}
malloc(sizeofBlockType)
calloc(1, sizeof(BlockType))