how to free device_vector<int>
cuda, gpu, thrust
Solution
`device_vector` deallocates the storage associated when it goes out of scope, just like any standard c++ container.
If you'd like to deallocate any Thrust `vector`'s storage manually during its lifetime, you can do so using the following recipe:
// empty the vector
vec.clear();
// deallocate any capacity which may currently be associated with vec
vec.shrink_to_fit();
The `swap` trick mentioned in Roger Dahl's answer should also work.
Problem
I allocated some space using thrust device vector as follows: ``` thrust::device_vector<int> s(10000000000); ``` How do i free this space explicitly and correctly?