<h2 dir="auto">Bug</h2>
<p dir="auto">Using libtorch causes memory leaks. but i think that it is very strange. because i only define <code class="notranslate">torch::DeiviceType</code>  , then got <strong>bug1</strong></p>
<h3 dir="auto">bug1</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="still reachable: 884,654 bytes in 13,927 blocks of which reachable via heuristic: stdstring :436062 bytes in 5832 blocks"><pre class="notranslate"><code class="notranslate">still reachable: 884,654 bytes in 13,927 blocks of which reachable via heuristic: stdstring :436062 bytes in 5832 blocks
</code></pre></div>
<h3 dir="auto">bug2</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="possibly lost: 3104 bytes in 22 blocks
still reachable: 1231592 bytes in 14005 blocks of which reachable via heuristic: stdstring :436062 bytes in 5832 blocks"><pre class="notranslate"><code class="notranslate">possibly lost: 3104 bytes in 22 blocks
still reachable: 1231592 bytes in 14005 blocks of which reachable via heuristic: stdstring :436062 bytes in 5832 blocks
</code></pre></div>
<h2 dir="auto">To Reproduce</h2>
<h3 dir="auto">bug1</h3>
<div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="int main()
{
 torch::DeviceType device_type;
}"><pre class="notranslate"><span class="pl-k">int</span> <span class="pl-en">main</span>()
{
 torch::DeviceType device_type;
}</pre></div>
<h3 dir="auto">bug2</h3>
<div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="int main()
{
 torch::DeviceType device_type;
if(torch::cuda::is_available())
{
device_type = torch::kCUDA;
}
else
{
device_type = torch::kCPU;
}
torch::Device device(device_type)
}"><pre class="notranslate"><span class="pl-k">int</span> <span class="pl-en">main</span>()
{
 torch::DeviceType device_type;
<span class="pl-k">if</span>(<span class="pl-c1">torch::cuda::is_available</span>())
{
device_type = torch::<span class="pl-c1">kCUDA</span>;
}
<span class="pl-k">else</span>
{
device_type = torch::<span class="pl-c1">kCPU</span>;
}
torch::Device <span class="pl-smi">device</span>(device_type)
}</pre></div>
<h2 dir="auto">Environment</h2>
<ul dir="auto">
<li>PyTorch Version : 1.4</li>
<li>libtorch Version: 1.4</li>
<li>OS (e.g., Linux): Ubuntu 14.04</li>
<li>How you installed PyTorch (<code class="notranslate">conda</code>, <code class="notranslate">pip</code>, source): pip</li>
<li>Python version: 3.5</li>
<li>CUDA/cuDNN version: 10</li>
</ul>
<p dir="auto">When compiling PyTorch from sources (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/pytorch/pytorch/commit/a80a46a6d01b792399d5860e00923d096399952f/hovercard" href="https://github.com/pytorch/pytorch/commit/a80a46a6d01b792399d5860e00923d096399952f"><tt>a80a46a</tt></a>) with the flag NO_DISTRIBUTED=1 it ends up with the Following error :</p>
<p dir="auto"><code class="notranslate">couldn't find libcudart. Make sure CUDA libraries are installed in adefault location, or that they're in LD_LIBRARY_PATH</code> comming from there : <a href="https://github.com/pytorch/pytorch/blob/master/torch/cuda/__init__.py#L66">https://github.com/pytorch/pytorch/blob/master/torch/cuda/__init__.py#L66</a></p>
<p dir="auto">Compiling with Distributed support makes the error disappear.</p>
<p dir="auto">Happened on Fedora 29, using GCC/G++ 7.3.1 with CUDA 9.2 / CuDNN 7.4.1 / GTX 1080 Ti</p>