CudaMalloc() makes page-locked memory fail simple variable assignement

I’ve a problem with page-locked memory.

passing a pointer to device memory in my kernel

the assignment fails and *h_value remains 0

otherwhise, removing the cudaMalloc instruction and

removing the parameters passed to the kernel everything

goes fine.

What could be the problem?

thank’s

[codebox]

void my_function(void){

    /****INIT*****/

int *h_value = NULL;

int *d_value = NULL;

    int size=1024;

dim3 block(1,1);

dim3 grid(1,1);

/ALLOCATION*/

    cudaMalloc((void**)&d_input_data, size); // **** This line makes kernel increment fail! ******

cudaSetDeviceFlags(cudaDeviceMapHost);

cudaHostAlloc((void**) &h_value, sizeof( int ) , cudaHostAllocMapped | cudaHostAllocPortable);

cudaHostGetDevicePointer( &d_value , h_value , 0 );

    //init value on host

*h_value=0;

my_kernel<<<grid,block>>>( d_input_data , d_value );

printf("h_value = %d \n",*h_value);

}

[/codebox]

[codebox]global void ky_kernel( char* device_array, int *value )

{

*value=1;

}

[/codebox]