Rewriting memory allocated via cudaHostAlloc()

Hi all,

I have a 100MB character array (h_array) that is allocated using cudaHostAlloc() with the flag cudaHostAllocWriteCombined.

The program first copies data into h_array on the host. When h_array is full, it’ll copy h_array to d_array on the device and some processing is done. When the processing is completed, h_array is “reused” in the sense that new data is copied to it again, starting from h_array[0]. The new data is meant to overwrite what was previously stored in h_array.

However, I’m getting segmentation fault when the new data is copied to h_array after processing is complete. There are no seg fault errors when I’m using regular malloc.

What is wrong? Can I not rewrite the memory when it’s pinned?

Thank you!