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:

[url]c++ - cuda call fails in destructor - Stack Overflow

Thanks for you help.
I will investigate more.