Home / Companies / DigitalOcean / Blog / Post Details
Content Deep Dive

Transparent Huge Pages and Alternative Memory Allocators: A Cautionary Tale

Blog post from DigitalOcean

Post Details
Company
Date Published
Author
Kunju Perath
Word Count
1,001
Language
English
Hacker News Points
-
Summary

The Redis instances experienced memory pressure due to issues with freeing memory after initial allocation, which was initially misinterpreted as a memory leak. The problem was caused by the interaction between an alternative memory allocator and transparent huge pages. Transparent huge pages allow applications to use large memory pages, but some allocators may not play nicely with this feature. In this case, the `jemalloc` library used by the Redis server process marked ranges of memory as free using `madvise(2)`, which caused problems when combined with transparent huge pages. The operating system was unable to evict pages marked as free because the entire page would have to be unneeded, leading to sustained memory pressure and eventually a Out Of Memory (OOM) kill for the Redis server process.