Commit ee091851 authored by Davis King's avatar Davis King

Fixed a slow memory leak that occurred when using cuDNN and tensors were created.

parent 84cd330c
...@@ -191,15 +191,13 @@ namespace dlib ...@@ -191,15 +191,13 @@ namespace dlib
int nc int nc
) )
{ {
if (n == 0 || nr == 0 || nc == 0 || k == 0) if (handle)
{ {
if (handle) cudnnDestroyTensorDescriptor((cudnnTensorDescriptor_t)handle);
{ handle = nullptr;
cudnnDestroyTensorDescriptor((cudnnTensorDescriptor_t)handle);
handle = nullptr;
}
} }
else
if (n != 0 && nr != 0 && nc != 0 && k != 0)
{ {
cudnnTensorDescriptor_t h; cudnnTensorDescriptor_t h;
CHECK_CUDNN(cudnnCreateTensorDescriptor(&h)); CHECK_CUDNN(cudnnCreateTensorDescriptor(&h));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment