1 //////////////////////////////////////////////////////////////////////////////
4 // ADLib, Prop and their related set of tools and documentation are in the
5 // public domain. The author(s) of this software reserve no copyrights on
6 // the source code and any code generated using the tools. You are encouraged
7 // to use ADLib and Prop to develop software, in both academic and commercial
8 // settings, and are free to incorporate any part of ADLib and Prop into
11 // Although you are under no obligation to do so, we strongly recommend that
12 // you give away all software developed using our tools.
14 // We also ask that credit be given to us when ADLib and/or Prop are used in
15 // your programs, and that this notice be preserved intact in all the source
18 // This software is still under development and we welcome any suggestions
19 // and help from the users.
23 //////////////////////////////////////////////////////////////////////////////
28 #include <AD/memory/arena.h> // Arenas
29 #include <AD/memory/boundtag.h> // Boundary tag memory manager
30 #include <AD/memory/buddy.h> // Fibonacci buddy system
31 #include <AD/memory/mempool.h> // Memory pool
32 #include <AD/memory/strpool.h> // String pool
34 int main(int argc
, char * argv
[])
36 StringPool A
; MemPool B
;
46 for (i
= 0; i
< 257; i
++)
47 { core
[i
] = C
[i
]; memset(core
[i
],255,i
);
51 BoundaryTag::Statistics S
= C
.statistics();
52 printf("pages = %d\n", S
.page_count
);
53 printf("bytes allocated = %d\n", S
.bytes_allocated
);
54 printf("bytes available = %d\n", S
.bytes_available
);
55 printf("free blocks = %d\n", S
.free_block_count
);
66 printf("pages = %d\n", S
.page_count
);
67 printf("bytes allocated = %d\n", S
.bytes_allocated
);
68 printf("bytes available = %d\n", S
.bytes_available
);
69 printf("free blocks = %d\n", S
.free_block_count
);
73 // double * x = arena();
74 // double * y = arena();
76 // arena.free(x); arena.free(y);
79 Buddy
buddy(block
, sizeof(block
));
81 for (i
= 0; i
< 257; i
++)
82 { core
[i
] = buddy
[i
]; memset(core
[i
],255,i
); }