|
@@ -8,9 +8,11 @@
|
|
|
int main(void) {
|
|
|
|
|
|
allocator_t systemallocator;
|
|
|
+ void *block_from_malloc;
|
|
|
void *p1, *p2, *p3;
|
|
|
-
|
|
|
- initialize_allocator(&systemallocator, malloc(ALLOCATOR_SIZE), ALLOCATOR_SIZE);
|
|
|
+
|
|
|
+ block_from_malloc = malloc(ALLOCATOR_SIZE);
|
|
|
+ initialize_allocator(&systemallocator, block_from_malloc, ALLOCATOR_SIZE);
|
|
|
|
|
|
p1 = custom_ahmalloc(&systemallocator, &systemallocator.heaps[0], (size_t) 1024);
|
|
|
custom_ahfree(&systemallocator, &systemallocator.heaps[0], p1);
|
|
@@ -19,5 +21,7 @@ int main(void) {
|
|
|
custom_ahfree(&systemallocator, &systemallocator.heaps[0], p2);
|
|
|
custom_ahfree(&systemallocator, &systemallocator.heaps[0], p3);
|
|
|
|
|
|
+ free(block_from_malloc);
|
|
|
+
|
|
|
return 0;
|
|
|
}
|