How to release hugepages from the crashed application
huge-pages, linux, memory-management
Solution
HugeTLB can either be used for shared memory (and Mark J. Bobak's answer would deal with that) or the app mmaps files created in a hugetlb filesystem. If the app crashes without removing those files they survive and keep corresponding memory 'allocated'.
Check hugeTLB filesystem and see if there are any leftover files from the app. Removing them would release the memory.
Problem
I have an application that uses hugepage and the application suddenly crashed due to some bug. After crashing, since the application does not release the hugepage properly, the free hugepage number is not increased in sys filesystem. ``` $ sudo cat /sys/kernel/mm/hugepages/hugepages-2048kB/free_hugepages 0 $ sudo cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages 1024 ``` Is there a way to release the hugepages by force?