|
@@ -17,15 +17,14 @@ void * custom_ahmalloc(allocator_t* allocator, heap_t* heap, size_t size) {
|
|
|
maptable_node_t *current_maptable_node;
|
|
|
void *current_block, *previous_block;
|
|
|
|
|
|
+#ifndef WITH_MEMORY_SPACE_AWARENESS
|
|
|
+
|
|
|
// Go to the system allocator if none was given
|
|
|
if(allocator == NULL) {
|
|
|
allocator = &systemallocator;
|
|
|
-#ifndef WITH_MEMORY_SPACE_AWARENESS
|
|
|
- // Currently all the memory space aware allocators are pre-initialized
|
|
|
if(allocator->initialized != true) {
|
|
|
initialize_allocator(allocator);
|
|
|
}
|
|
|
-#endif /* WITH_MEMORY_SPACE_AWARENESS */
|
|
|
}
|
|
|
|
|
|
if(heap == NULL) {
|
|
@@ -33,6 +32,8 @@ void * custom_ahmalloc(allocator_t* allocator, heap_t* heap, size_t size) {
|
|
|
heap = &allocator->heaps[heap_id];
|
|
|
}
|
|
|
|
|
|
+#endif /* WITH_MEMORY_SPACE_AWARENESS */
|
|
|
+
|
|
|
ptr = NULL;
|
|
|
previous_block = NULL;
|
|
|
|
|
@@ -108,7 +109,13 @@ void * custom_ahmalloc(allocator_t* allocator, heap_t* heap, size_t size) {
|
|
|
return ptr;
|
|
|
}
|
|
|
|
|
|
+/* Currently all the memory space aware allocators are pre-initialized, so
|
|
|
+ * we do not expect any custom_ahmalloc call without knowing which allocator
|
|
|
+ * and heap are to be used.
|
|
|
+ */
|
|
|
+#ifndef WITH_MEMORY_SPACE_AWARENESS
|
|
|
void * custom_malloc(size_t size) {
|
|
|
return custom_ahmalloc(NULL, NULL, size);
|
|
|
}
|
|
|
+#endif /* WITH_MEMORY_SPACE_AWARENESS */
|
|
|
|