比特币src002

glibc:

util.cpp

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

Its the implementation of Standard C library described in C standards plus some extra useful stuffs which are not strictly standard but used frequently.

Its main contents are :

1) C library described in ANSI,c99,c11 standards. It includes macros, symbols, function implementations etc.(printf(),malloc() etc)

2) POSIX standard library. The "userland" glue of system calls. (open(),read() etc. Actually glibc does not "implement" system calls. kernel does it. But glibc provides the user land interface to the services provided by kernel so that user application can use a system call just like a ordinary function.

3) Also some nonstandard but useful stuff.

"use the force, read the source "

$git clone git://sourceware.org/git/glibc.git

(I was recently pretty enlightened when i looked through malloc.c in glibc)

猜你喜欢

转载自blog.csdn.net/creator123123/article/details/82021354