Does CUDA has cudarealloc()?

Does CUDA has cudaHostRealloc()?

I have try to write a cudaHostRealloc() by combining
cudaMemcpy()
cudaHostAlloc()
cudaFreeHost()

as follow

void HostRealloc(void *p, void *p2, int size) {
cudaHostAlloc(p2,size,cudaHostAllocMapped)
cudaMemcpy(p2, p, size, cudaMemcpyHostToHost);
cudaFreeHost(p);
return;
};

however it will appear segmentation fault will doing cudaMemcpy();

You need to pass in the old size of the allocation as well, so that you can copy over only [font=“Courier New”]min(size, old_size)[/font] bytes.