When cuda driver will be unloaded in cuda program?

I got an error because of calling cudaFreeHost after cuda driver unloaded.
so, i want know when cuda driver is unloaded in cuda project.
i am developing c project in visual studio.
Thanks.

did you call cudaFreeHost in a destructor?

yes

Perhaps your destructor is also part of a class that is defined outside of main (static or at global scope)
Generally that can be troublesome.

Read here:

http://stackoverflow.com/questions/35815597/cuda-call-fails-in-some-singleton-global-variables-destructor-when-using-map

Thanks for you help.
I will investigate more.