title: QNetworkAccessManager not releasing memory
body: <p>I'm using Qt 4.7. My my sync process is using a different thread. We use the QNetworkAccessManager in order to apply to the server to perform the sync. I noticed that all the memory used by the QNetworkReply its never release. </p>
  
  <p>After reading several pages and had different test, I understand that its not a memory leak as some people stand, but its a problem of releasing the memory. Actually its even acceptable to have this memory used, but obviously, since im working in embbeded, as more memory as better (not only for embbeded). </p>
  
  <p>The thing is that every time we sync (60 sec) the memory does not increase, but after the delete later, it also does not free it. </p>
  
  <p>Although its not very orthodox, im using Top to check the memory usage.</p>
  
  <p>My code:</p>
  
  <pre><code>Sync::Sync(const Settings &amp;settings)
  {
  
  net_manager = new QNetworkAccessManager(this);
  reply_ = 0;
  }
  </code></pre>
  
  <p>Get the status from url:</p>
  
  <pre><code> void Sync::get_status()
  {
  QUrl url(status_url);
  
  connect( net_manager, SIGNAL(finished(QNetworkReply*)),
          this, SLOT(reply_status(QNetworkReply*)) );
  
  reply_ = net_manager-&gt;get(QNetworkRequest(url));
  
  connect(reply_, SIGNAL(error(QNetworkReply::NetworkError)),
          this, SLOT(slDownloadFilesError(QNetworkReply::NetworkError)));
  
  }
  </code></pre>
  
  <p>And the reply fucntion:</p>
  
  <pre><code>void Sync::reply_status(QNetworkReply* reply)
  {
  
     if ( reply-&gt;error() != QNetworkReply::NoError ) {
         qDebug()&lt;&lt;"[Sync]" &lt;&lt; "..........NETWORK ERROR: " &lt;&lt; reply-&gt;error() &lt;&lt; "\nERROR STRING: " &lt;&lt;reply-&gt;errorString();
  
         sl_freeMemory();
         return;
     }
  
  sl_freeMemory();
  
  //Do whatever...
  
  }
  </code></pre>
  
  <p>Last part: </p>
  
  <pre><code>void Sync::sl_freeMemory()
  {
  if(reply_ == 0)
      return;
  
  disconnect( net_manager, SIGNAL(finished(QNetworkReply*)),
          this, SLOT(reply_status(QNetworkReply*)) );
  
  disconnect(reply_, SIGNAL(error(QNetworkReply::NetworkError)),
          this, SLOT(slDownloadFilesError(QNetworkReply::NetworkError)));
  
  reply_-&gt;abort();
  reply_-&gt;deleteLater();
  reply_ = 0;
  
  
  }
  </code></pre>
  
  <p>I really appreciate any kind of hint you can give me. I checked several sites and the logic its the same as the one im using.</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>Edit:</strong> Following the advice of @vahancho i did the following modifications. 
  Every time i want to sync i create the networkmanager with    </p>
  
  <pre><code>net_manager = new QNetworkAccessManager(this); (Inside get_status()).
  </code></pre>
  
  <p>In the sl_freeMemory() i added</p>
  
  <pre><code>net_manager-&gt;disconnect();
  net_manager-&gt;deleteLater();
  </code></pre>
  
  <p>Nothing change, does not increase / decrease or release the memory.</p>