Repeatedly executing kernel (malloc & free) and kernel failure. Any way to refresh by command ?

Repeatedly executing kernel (malloc & free) and kernel failure.
Is there any utility or command to just wipe out the memory cleanly ? between executing different cuda programs in the Linux shell?
I need to repeatedly execute CUDA programs, but for some time, kernel failure occurs…
Thanks