Top
Best
New

Posted by mfiguiere 2 hours ago

Memory Subsystem Optimizations(johnnysswlab.com)
25 points | 3 comments
jeffbee 1 hour ago
I find this site interesting because of its mixture of good topic choice and inaccurate details. I think it's generated by LLMs.

Specifically catching my eye in this collection of articles is the highly misleading one about huge pages. All recent Linux distributions have THP set to "madvise" by default. Many programs exploit THP automatically, including any Go program and any JVM program with a flag set. The tcmalloc shared library that comes with Ubuntu is probably the single worst way to experience huge pages. Mi-malloc is the better choice if you must preload a library, but there are even better choices. Explicit huge pages are little-used because managing them is annoying. Finally, latest Linux kernels have features called "folios"and "mTHP" that make THP even smoother.

foltik 1 hour ago|
> Mi-malloc is the better choice if you must preload a library, but there are even better choices.

What’s a better choice?

jeffbee 56 minutes ago||
Linking the allocator into your program when you build it, instead of overriding just malloc and free at runtime. Then you can choose between jemalloc, mi-malloc, TCMalloc, or whatever you please, and get better features such as C++ sized delete. Rust makes this easy with for example "use tcmalloc_better::TCMalloc".