当可用内存低但可用内存高时,应用程序失败

Application fails when free memory is low but available memory is high

我正在 Linux 上通过一个名为 Sisense 的应用程序构建数据模型。最近,该过程因内存不足错误而失败。 运行 free -h 我发现故障发生在可用内存不足时,但在它实际达到零之前,即使仍有足够的可用内存。

例外情况:

Failed to build custom table: Rule_pre; BE#521691 SQL error: SafeModeException:
Safe-Mode triggered due to memory pressure. Pod physical memory: 5.31 GB available, 2.87 GB 
used, 8.19 GB total. Server physical memory: 4.86 GB available, 28.67 GB used, 
33.54 GB total. Application total virtual memory: 2.54 GB. The server exceeded 85% capacity 
(28.67/33.54). Possible ways to reduce memory pressure: increase server memory, adjust data 
modelling (M2M, un-indexed string fields, etc.), reduce number of simultaneous queries

这里是 free -h 的输出,您可以在中间的“空闲”列中看到正在下降的内存。一旦可用内存低于 235 MB,我就会看到上述异常。

free util 手册页对可用内存有以下定义:

free Unused memory (MemFree and SwapFree in /proc/meminfo)

available Estimation of how much memory is available for starting new applications, without swapping. Unlike the data provided by the cache or free fields, this field takes into account page cache and also that not all reclaimable memory slabs will be reclaimed due to items being in use (MemAvailable in /proc/meminfo, available on kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as free

正如我在 Internet 上看到的那样,似乎对低可用内存很随意。这不是问题。但失败恰逢可用内存变低。如果我理解手册页,可用内存用于启动新应用程序。我假设可用内存对失败的现有应用程序不可用,而空闲内存确实很重要。但任何来自其他人的确认或额外的解释将不胜感激。我也很好奇关于这是否可能构成内存泄漏或者我是否应该简单地在 Linux 层以某种方式分配更多内存的意见。

我想我对这里的理解已经足够了。无论构建失败还是成功,可用内存都不会低于 200MB。它似乎不是问题的指标。成功的构建还将显示可用内存下降到 200MB。