MCPcopy Create free account
hub / github.com/ElementsProject/elements / SetupEnvironment

Function SetupEnvironment

src/util/system.cpp:1355–1380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1353}
1354
1355void SetupEnvironment()
1356{
1357#ifdef HAVE_MALLOPT_ARENA_MAX
1358 // glibc-specific: On 32-bit systems set the number of arenas to 1.
1359 // By default, since glibc 2.10, the C library will create up to two heap
1360 // arenas per core. This is known to cause excessive virtual address space
1361 // usage in our usage. Work around it by setting the maximum number of
1362 // arenas to 1.
1363 if (sizeof(void*) == 4) {
1364 mallopt(M_ARENA_MAX, 1);
1365 }
1366#endif
1367 // On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
1368 // may be invalid, in which case the "C.UTF-8" locale is used as fallback.
1369#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
1370 try {
1371 std::locale(""); // Raises a runtime error if current locale is invalid
1372 } catch (const std::runtime_error&) {
1373 setenv("LC_ALL", "C.UTF-8", 1);
1374 }
1375#elif defined(WIN32)
1376 // Set the default input/output charset is utf-8
1377 SetConsoleCP(CP_UTF8);
1378 SetConsoleOutputCP(CP_UTF8);
1379#endif
1380}
1381
1382bool SetupNetworking()
1383{

Callers 7

mainFunction · 0.85
mainFunction · 0.85
bitcoin-util.cppFile · 0.85
mainFunction · 0.85
mainFunction · 0.85
BasicTestingSetupMethod · 0.85
GuiMainFunction · 0.85

Calls

no outgoing calls

Tested by 1

BasicTestingSetupMethod · 0.68