@lbdalmendrayCaseguar
Hi, sry, for reply late. What is your libtorch version?
I tested your code with latest libtorch.
What I got is that, the cuda initialization takes 0.6-0.7 GB memory, and after created your tensorCreated, total memory is around 1.8 GB,
and after calling cudaFree(tensorCreated.data_ptr()); memory usage back to 0.6-0.7GB.
If you are using an old version libtorch, it probably a previous bug.
Let me know.
Here is some GPU memory info:
Cuda initialized:
±----------------------------------------------------------------------------+
| NVIDIA-SMI 418.126.02   Driver Version: 418.126.02   CUDA Version: 10.1     |
|-------------------------------±---------------------±---------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla M40           On   | 00000000:0B:00.0 Off |                    0 |
| N/A   28C    P0    69W / 250W |    639MiB / 11448MiB |      0%      Default |
±------------------------------±---------------------±---------------------+
Tensor created:
±----------------------------------------------------------------------------+
| NVIDIA-SMI 418.126.02   Driver Version: 418.126.02   CUDA Version: 10.1     |
|-------------------------------±---------------------±---------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla M40           On   | 00000000:0B:00.0 Off |                    0 |
| N/A   26C    P0    66W / 250W |   1785MiB / 11448MiB |      0%      Default |
±------------------------------±---------------------±---------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0   3810476      C   ./tests                                     1774MiB |
±----------------------------------------------------------------------------+
Tensor freed:
±----------------------------------------------------------------------------+
| NVIDIA-SMI 418.126.02   Driver Version: 418.126.02   CUDA Version: 10.1     |
|-------------------------------±---------------------±---------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla M40           On   | 00000000:0B:00.0 Off |                    0 |
| N/A   28C    P0    69W / 250W |    639MiB / 11448MiB |      0%      Default |
±------------------------------±---------------------±---------------------+