@ -72,6 +72,10 @@
# include <sys/prctl.h>
# include <sys/prctl.h>
# endif
# endif
# ifdef HAVE_MALLOPT_ARENA_MAX
# include <malloc.h>
# endif
# include <boost/algorithm/string/case_conv.hpp> // for to_lower()
# include <boost/algorithm/string/case_conv.hpp> // for to_lower()
# include <boost/algorithm/string/join.hpp>
# include <boost/algorithm/string/join.hpp>
# include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith()
# include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith()
@ -792,6 +796,16 @@ void RenameThread(const char* name)
void SetupEnvironment ( )
void SetupEnvironment ( )
{
{
# ifdef HAVE_MALLOPT_ARENA_MAX
// glibc-specific: On 32-bit systems set the number of arenas to 1.
// By default, since glibc 2.10, the C library will create up to two heap
// arenas per core. This is known to cause excessive virtual address space
// usage in our usage. Work around it by setting the maximum number of
// arenas to 1.
if ( sizeof ( void * ) = = 4 ) {
mallopt ( M_ARENA_MAX , 1 ) ;
}
# endif
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
// may be invalid, in which case the "C" locale is used as fallback.
// may be invalid, in which case the "C" locale is used as fallback.
# if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
# if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)