[OpenSIPS-Devel] [OpenSIPS/opensips] 3b2586: rest_client: Let libcurl use the system malloc fu...

Liviu Chircu noreply at github.com
Thu Jul 11 11:03:11 EDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 3b2586d64828e89525ae050897c8bd62a9c9ce92
      https://github.com/OpenSIPS/opensips/commit/3b2586d64828e89525ae050897c8bd62a9c9ce92
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2019-07-11 (Thu, 11 Jul 2019)

  Changed paths:
    M modules/rest_client/rest_client.c

  Log Message:
  -----------
  rest_client:  Let libcurl use the system malloc functions

The fact that libcurl spawns a thread in order to perform each transfer
is well known.  Also known was the fact that by instructing libcurl to
use the pkg_*alloc() functions, an OpenSIPS worker must synchronize with
the libcurl thread before they can both manipulate the PKG pool.  Commit
900f6c996c697b was an attempt to solve this, however the fix DOES NOT
hold, as it was implemented in that commit (the curl thread is aware of
the thread lock while the original process ignores it...).

The only way we can make libcurl use the opensips pkg mem allocation
functions is by changing pkg_malloc() itself to also grab a thread
lock.  And this is already too much, as it would unnecessarily slow down
the pkg allocator, while the benefits are minimal anyway: what do we
stand to gain if libcurl uses our mem pool?  Close to nothing.

We just let libcurl use the system memory manager (along with as much
memory as it wants) and we're done with this issue for good.

Fixes #1546





More information about the Devel mailing list