Tech News
← Home  ·  All topics

Glibc

4 GoKawiil briefs on this topic · RSS for glibc

Deep dive explains how glibc's malloc minimizes brk syscalls

A technical write-up traces how glibc's malloc implementation manages memory requests internally rather than calling the kernel every time. Using strace on a test program that calls malloc(16) a thousand times, the analysis shows only two brk syscalls occur in total: one to check the current program break and one to extend the heap by 132 KiB, with the remaining 999 allocations served from that pre-reserved memory.

Blog post catalogs where GCC and Clang diverge from the C standard

A technical blog post lists concrete cases where GCC and Clang do not conform to the ISO C standard by default, including treatment of the asm keyword as a reserved extension and GCC's hardcoded FLT_ROUNDS macro that ignores runtime rounding-mode changes via fesetround. The author also flags unfinished coverage of the standard's five floating-point pragmas as an area of ongoing non-conformance.

C standard leaves strtod error detection non-portable across libc implementations

A blog post examines C17 section 7.25.2.6, which governs error handling for strtod, strtof, strtold and related string-to-float conversion functions. It explains that these functions' ability to report overflow or underflow via errno depends on the math_errhandling macro, and that on libraries like musl where MATH_ERRNO is not advertised, there is no standard-compliant way to detect these conversion errors. The author notes that Linux man pages for these functions omit this detail entirely.

Benchmarks show musl libc lags glibc by up to 26% even with mimalloc swapped in

A developer investigating containerized Rust performance found that musl's default memory allocator is significantly slower than glibc's, not just under high concurrency but even on modest 4-core EC2 instances. Swapping in mimalloc or jemalloc narrows the gap but doesn't close it—one workload remained 26% slower—because several of musl's core memory routines are themselves inefficient, not just its allocator.