|
@@ -40,7 +40,18 @@ void *sys_alloc(allocator_t *allocator, heap_t *heap, size_t size) {
|
|
|
|
|
|
allocation_size = req_padding(size) + HEADER_SIZE;
|
|
allocation_size = req_padding(size) + HEADER_SIZE;
|
|
|
|
|
|
|
|
+ /* Before the first application malloc() call, the allocator uses
|
|
|
|
+ * sys_alloc() to allocate space for its metadata. So, these are the first
|
|
|
|
+ * data blocks in the heaps and there are no previous data blocks.
|
|
|
|
+ */
|
|
|
|
+#ifndef WITH_MEMORY_SPACE_AWARENESS
|
|
if(allocator->border_ptr != NULL) {
|
|
if(allocator->border_ptr != NULL) {
|
|
|
|
+#else
|
|
|
|
+ /* Note: border_ptr has already a value in memory space aware allocators,
|
|
|
|
+ * so in this case we have to check also the initialized value.
|
|
|
|
+ */
|
|
|
|
+ if(allocator->border_ptr != NULL && allocator->initialized) {
|
|
|
|
+#endif /* WITH_MEMORY_SPACE_AWARENESS */
|
|
previous_size = get_size(allocator->border_ptr);
|
|
previous_size = get_size(allocator->border_ptr);
|
|
previous_size_availability = get_size_availability(allocator->border_ptr);
|
|
previous_size_availability = get_size_availability(allocator->border_ptr);
|
|
} else {
|
|
} else {
|