CudaFree a struct pointer?

Hello,

Here is an example about i want to do:

struct datastruct { int data1, int* data2 };
datastruct* Dev_dtstrct;
CudaMalloc(Dev_dtstrct.....);
...
...
...
//Free the device memory after usage
CudaFree(Dev_dtstrct);

Will the CudaFree also free the data2 pointer inside the structure?

Thanks

Regards

Abdoulaye

it will not.

The behavior is similar to host code usage of C-standard malloc and free. If you had an instance of a struct like that in host allocated memory, and you used free on the pointer, it would not free any embedded pointers/allocations.

Alright ! Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.