mirror of
https://github.com/vivier/EMILE.git
synced 2025-08-15 07:27:41 +00:00
try to find a contiguous block until it finds or there is no more memory
This commit is contained in:
@@ -255,6 +255,8 @@ void *malloc_contiguous(size_t size)
|
|||||||
size_t part_size;
|
size_t part_size;
|
||||||
|
|
||||||
tmp = malloc(size);
|
tmp = malloc(size);
|
||||||
|
if (tmp == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (check_full_in_bank((unsigned long)tmp, size))
|
if (check_full_in_bank((unsigned long)tmp, size))
|
||||||
return tmp;
|
return tmp;
|
||||||
@@ -268,15 +270,9 @@ void *malloc_contiguous(size_t size)
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
tmp = malloc(part_size);
|
tmp = malloc(part_size);
|
||||||
contiguous = malloc(size);
|
contiguous = malloc_contiguous(size);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
if (!check_full_in_bank((unsigned long)contiguous, size))
|
|
||||||
{
|
|
||||||
free(contiguous);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return contiguous;
|
return contiguous;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user