-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
65 lines (43 loc) · 802 Bytes
/
main.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
/*#include <stdio.h>*/
#include <strings.h>
#include "memory_allocator.h"
void mainer() {
char *a,*b,*c;
int i;
void *arr[1000];
for (i=0; i<10;i++){
size_t sz=i%50+1;
sz=50;
/*printf("%d allocating %u\n",i,sz);*/
putchar('A');
putchar('\n');
arr[i]=(char*)malloc(sz);
if (!arr[i])
{
printf("Error %d\n",i);
exit(0);
}
}
for (i=0; i<10;i++){
/*printf("%d freeing\n",i);*/
putchar('D');
putchar('\n');
free(arr[i]);
}
printf("done\n");
/*
a=(char*)malloc(65536);
b=(char*)malloc(10);
c=(char*)malloc(10);
strcpy(a,"nir ");
strcpy(b,"dothan ");
strcpy(c,"is here ");
printf("%s %s %s\n",a,b,c);
free((void*)a);
printf(" %s %s\n",b,c);
free((void*)b);
printf(" %s\n",c);
free((void*)c);
*/
return;
}