示例#1
0
文件: free.c 项目: Selk/Dev
void	free(void *ptr)
{
	t_block	*b;

	if (ptr == NULL)
		return ;
	b = search_ptr(ptr);
	if (b == NULL)
		return ;
	b = fusion_block(b);
	check_page(b);
}
示例#2
0
文件: free.c 项目: akabab/malloc
void		free_exec(void *ptr)
{
	t_block		*b;
	t_region	*r;

	if (!ptr)
		return ;
	if ((r = get_valid_region(ptr)) != NULL)
	{
		b = get_block(ptr);
		b->is_free = TRUE;
		if (b->prev && b->prev->is_free)
			b = fusion_block(b->prev);
		if (b->next && b->next->is_free)
			fusion_block(b);
		if (!b->next && !b->prev)
		{
			if (r->type == LARGE || (r->prev || r->next))
				free_region(r);
		}
	}
}