Hi, I am using webkit browser for my embedded linux platform with memory swap. However, when I check the source code, I can see that MemoryPressureHandlerLinux.cpp does not consider swap memory. Looking inside the MemoryUsagePoller function, we are only monitoring the VmRSS value. So, in the Linux environment using memory swap (HDD swap, etc.), I confirmed that memory clear (garbage collection) is not done at the time I expect. This will result in OOM of the platform in severe cases. I'd suggest that not only the VmRSS values should be monitored, but also the VmSwap as well.
This is my suggetion : diff --git a/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp b/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp index fb86ee9d996d..674ff297837c 100644 --- a/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp +++ b/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp @@ -248,13 +248,14 @@ MemoryPressureHandler::MemoryUsagePoller::MemoryUsagePoller() bool critical = false; bool synchronous = false; size_t value = 0; + size_t value_swap = 0; if (s_pollMaximumProcessMemoryCriticalLimit) { - if (readToken(s_processStatus, "VmRSS:", KB, value)) { - if (value > s_pollMaximumProcessMemoryNonCriticalLimit) { + if (readToken(s_processStatus, "VmRSS:", KB, value) && readToken(s_processStatus, "VmSwap:", KB, value_swap)) { + if (value + value_swap > s_pollMaximumProcessMemoryNonCriticalLimit) { underMemoryPressure = true; - critical = value > s_pollMaximumProcessMemoryCriticalLimit; - synchronous = value > s_pollMaximumProcessMemoryCriticalLimit * 1.05; + critical = value + value_swap > s_pollMaximumProcessMemoryCriticalLimit; + synchronous = value + value_swap > s_pollMaximumProcessMemoryCriticalLimit * 1.05; } } }
Sorry. I should report this issue to the WPEWebkit project. I will closed it.
(In reply to Donghwa Kim from comment #2) > Sorry. I should report this issue to the WPEWebkit project. > I will closed it. Hi Donghwa! You have reported your bug correctly... this Bugzilla is for all the WebKit ports, including WPE =) Let's reopen this, I am CC'ing a coouple of developers who may have a better idea than me about this topic.
While the upstream version of WPE has the same problem, the code Donghwa is referring to belongs to the WebPlatformForEmbedded version of WPE.
Here is my WPEWebkit pull request link : https://github.com/WebPlatformForEmbedded/WPEWebKit/pull/1017