curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Memory leak with curl_multi_socket_action

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 26 May 2020 16:43:14 +0200 (CEST)

On Tue, 26 May 2020, James Read via curl-library wrote:

> When parallel connections reaches 0 g->still_running is still reporting a
> number of easy handles in progress. How can this be? Surely, the answer to
> this question is the answer to the memory leaks?

Your code makes funny assumptions about sockets and transfers correlations
that seem incorrect. They're not mapped 1:1. A single transfer may add one,
two or more sockets to monitor. Multiple transfers may add more or may reuse
the same sockets. You can count socket if you want, but do not presume that
you know how many transfers a certain number of monitored sockets actually
mean.

If you want to count number of concurrent transfers, count how many easy
handles you've added to the multi handle and subtract again when you remove
them.

-- 
  / daniel.haxx.se | Commercial curl support up to 24x7 is available!
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2020-05-26