Sfoglia il codice sorgente

Print an error in case sbrk fails.

Ioannis Koutras 14 anni fa
parent
commit
7e453a2760
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      sys_alloc.c

+ 3 - 0
sys_alloc.c

@@ -15,6 +15,9 @@ void *sys_alloc(heap_t *heap, size_t size) {
 	allocation_size = req_padding(size) + HEADER_SIZE;
 
 	ptr = sbrk((int) allocation_size);
+	if(ptr == (void *) -1) {
+		printf("sbrk problem for size of: %d\n", allocation_size);
+	}
 	ptr = (void *) ((char *) ptr + HEADER_SIZE);
 
 	set_size(ptr, req_padding(size));