HI everyone,
_SBLOCK *allocateMemBlock(size_t size)
[
_SBLOCK *block = (_SBLOCK*)sbrk(0);
void *memadr = (void*)sbrk(0);
void *allocate_mem = (void*)sbrk(BLOCK_SIZE + size);
if(allocate_mem == (void*)-1)
[
return NULL;
]
else
[
block->next = NULL;
block->isfree = false;
block->size = size;
block->memoryAddress = memadr+BLOCK_SIZE;
return block;
]