cudaMemcpy problem - pass vector data to the funcion

Hello everyone,

I have the following problem in my C++ code. I think it is pretty basic, but I have no clue how to avoid this:

  1. I have 1D vector filled with data:
    vector image;

  2. Then I allocate memory on GPU (works fine!).
    double *d_image;

  3. Here’s the problem:

The error comes out:
“Unhandled exception at 0x52858b34 in 2ndcuda.exe: 0xC0000005: Access violation reading location 0x002a1000.”

How to solve this?