<p dir="auto">we found if we create and finish  much thread  and use  Parallel_for in these thread ,  system will be<br>
out of memory and  i study the code and found for every thread  TlsStorage will cache the  Thread data and  slotdata but never release  util  my process exit</p>
<ul dir="auto">
<li>OpenCV =&gt; 3.3.0</li>
<li>Operating System / Platform =&gt; Arch Linux (4.12.13-1-ARCH SMP PREEMPT x86_64 GNU/Linux)</li>
<li>Compiler =&gt; gcc 7.2.0 and clang 5.0.0</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">It seems that a significant portion of memory is leaked in every thread.<br>
The following code snippet consumes cca 100MB/s.</p>
<h5 dir="auto">Steps to reproduce</h5>
<div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#include &lt;opencv2/opencv.hpp&gt;
#include &lt;future&gt;
int main()
{
    while(true) {
        std::async(std::launch::async, []() { cv::Mat::zeros(1, 1, CV_32FC3); }).wait();
    }
}"><pre class="notranslate">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>opencv2/opencv.hpp<span class="pl-pds">&gt;</span></span>
#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>future<span class="pl-pds">&gt;</span></span>
<span class="pl-k">int</span> <span class="pl-en">main</span>()
{
    <span class="pl-k">while</span>(<span class="pl-c1">true</span>) {
        <span class="pl-c1">std::async</span>(std::launch::async, []() { <span class="pl-c1">cv::Mat::zeros</span>(<span class="pl-c1">1</span>, <span class="pl-c1">1</span>, CV_32FC3); }).<span class="pl-c1">wait</span>();
    }
}</pre></div>