소스 검색

sys_alloc() should check and warn for sbrk() only when coalescing is enabled.

Ioannis Koutras 13 년 전
부모
커밋
14d738fcff
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      src/sys_alloc.c

+ 4 - 4
src/sys_alloc.c

@@ -27,7 +27,6 @@
 #include "other.h"
 #include "sys_alloc.h"
 #include "block_header.h"
-#include "print_stats.h"
 
 void *sys_alloc(allocator_t *allocator, heap_t *heap, size_t size) {
 
@@ -55,12 +54,13 @@ void *sys_alloc(allocator_t *allocator, heap_t *heap, size_t size) {
         printf("Error on sbrk: %s\n", strerror( errno ) );
         return NULL;
     }   
+#if defined (COALESCING_FIXED) || defined (COALESCING_VARIABLE)
     if(allocator->border_ptr != NULL && ptr != (void *) 
             ((char *) allocator->border_ptr + previous_size)) {
-        printf("sbrk() does not return sequential space.\n");
-        print_stats(allocator);
-        return NULL;
+        printf("sbrk() does not return sequential space. "
+                "You should disable coalescing.\n");
     }
+#endif /* COALESCING_FIXED || COALESCING_VARIABLE */    
 #else
     if(allocator->remaining_size >= allocation_size) {
         ptr = (void *) ((char *) allocator->border_ptr + previous_size);