예제 #1
0
void *realloc(void *ptr, size_t size) {
	void* ret = allocator_realloc(allocator_get_global(), ptr, size);
	if (!ret) {
		errno = ENOMEM;
	}
	return ret;
}
예제 #2
0
int main(int argc, char* argv[])
{
	int i = 0;
	int n = 100;
	Allocator* allocator = allocator_normal_create();

	for(i = 0; i < n; i++)
	{
		char* ptr = allocator_alloc(allocator, i);
		ptr = allocator_realloc(allocator, ptr, i+4);
		allocator_free(allocator, ptr);
		ptr = allocator_calloc(allocator, i+4, 4);
		allocator_free(allocator, ptr);
	}
	
	allocator_destroy(allocator);

	return 0;
}