|
@@ -44,8 +44,11 @@ static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
|
|
|
|
|
|
void *sys_alloc(allocator_t *allocator, heap_t *heap, size_t size) {
|
|
|
|
|
|
- size_t allocation_size, previous_size, previous_size_availability;
|
|
|
+ size_t allocation_size, previous_size_availability;
|
|
|
void *ptr;
|
|
|
+#if defined (WITH_MEMORY_SPACE_AWARENESS) || (!defined (WITH_MEMORY_SPACE_AWARENESS) && (defined (COALESCING_FIXED) || defined (COALESCING_VARIABLE)))
|
|
|
+ size_t previous_size;
|
|
|
+#endif /* check if previous_size is needed */
|
|
|
#ifdef WITH_MMAP
|
|
|
int fd;
|
|
|
#endif /* WITH_MMAP */
|
|
@@ -62,16 +65,20 @@ void *sys_alloc(allocator_t *allocator, heap_t *heap, size_t size) {
|
|
|
*/
|
|
|
#ifndef WITH_MEMORY_SPACE_AWARENESS
|
|
|
if(allocator->border_ptr != NULL) {
|
|
|
+#if defined (COALESCING_FIXED) || defined (COALESCING_VARIABLE)
|
|
|
+ previous_size = get_size(allocator->border_ptr);
|
|
|
+#endif /* COALESCING_FIXED || COALESCING_VARIABLE */
|
|
|
#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_availability = get_size_availability(allocator->border_ptr);
|
|
|
} else {
|
|
|
+#if defined (WITH_MEMORY_SPACE_AWARENESS) || (!defined (WITH_MEMORY_SPACE_AWARENESS) && (defined (COALESCING_FIXED) || defined (COALESCING_VARIABLE)))
|
|
|
previous_size = 0;
|
|
|
+#endif /* check if previous_size is needed */
|
|
|
previous_size_availability = 1; /* Occupied and of 0 size */
|
|
|
allocator->initialized = true;
|
|
|
}
|