-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.c
77 lines (52 loc) · 1.14 KB
/
test.c
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "halde.h"
int main(int argc, char *argv[]) {
printList();
char *m1 = malloc(2*1024);
printList();
char *m2 = malloc(100*1024);
printList();
char *m3 = malloc(12*1024);
printList();
char *m4 = malloc(3*16);
printList();
free(m1);
printList();
free(m2);
printList();
free(m3);
printList();
free(m4);
printList();
char *m5 = calloc(20, sizeof(int));
printList();
char *m6 = malloc(256);
printList();
free(m5);
printList();
char *m7 = malloc(400*1024);
printList();
char *m8 = malloc(30*1024);
printList();
m6 = realloc(m6, 10*2014);
printList();
free(m7);
printList();
free(m8);
printList();
free(m6);
printList();
char *m9 = malloc(512);
printList();
free(NULL); //SPECIAL CASE: THIS SHOULD DO NOTHING
printList();
char *m10 = realloc(NULL, 40*1024); //SPECIAL CASE: THIS SHOULD WORK LIKE MALLOC
printList();
free(m9);
printList();
free(m10);
printList();
exit(EXIT_SUCCESS);
}