fix compiler errors
This commit is contained in:
parent
87012bf98e
commit
ac7e6c0691
@ -36,6 +36,9 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <sys/sysinfo.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* Data structures
|
* Data structures
|
||||||
@ -426,14 +429,14 @@ int getMaxmemoryState(size_t *total, size_t *logical, size_t *tofree, float *lev
|
|||||||
maxmemory = static_cast<size_t>(maxmemory*1.2);
|
maxmemory = static_cast<size_t>(maxmemory*1.2);
|
||||||
|
|
||||||
/* If free system memory is below a certain threshold, force eviction */
|
/* If free system memory is below a certain threshold, force eviction */
|
||||||
size_t sys_free_mem_buffer;
|
long sys_free_mem_buffer;
|
||||||
if (g_pserver->force_eviction_percent && g_pserver->cron_malloc_stats.sys_total) {
|
if (g_pserver->force_eviction_percent && g_pserver->cron_malloc_stats.sys_total) {
|
||||||
float free_mem_ratio = (float)(100 - g_pserver->force_eviction_percent)/100;
|
float free_mem_ratio = (float)(100 - g_pserver->force_eviction_percent)/100;
|
||||||
size_t min_free_mem = static_cast<size_t>(g_pserver->cron_malloc_stats.sys_total * free_mem_ratio);
|
size_t min_free_mem = static_cast<size_t>(g_pserver->cron_malloc_stats.sys_total * free_mem_ratio);
|
||||||
sys_free_mem_buffer = static_cast<size_t>(g_pserver->cron_malloc_stats.sys_free - min_free_mem);
|
sys_free_mem_buffer = static_cast<long>(g_pserver->cron_malloc_stats.sys_free - min_free_mem);
|
||||||
if (sys_free_mem_buffer < 0) {
|
if (sys_free_mem_buffer < 0) {
|
||||||
size_t mem_threshold = static_cast<size_t>(mem_reported + sys_free_mem_buffer);
|
long mem_threshold = mem_reported + sys_free_mem_buffer;
|
||||||
maxmemory = (maxmemory < mem_threshold) ? maxmemory : mem_threshold;
|
maxmemory = (maxmemory < mem_threshold) ? maxmemory : static_cast<size_t>(mem_threshold);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2314,7 +2314,7 @@ void cronUpdateMemoryStats() {
|
|||||||
if (!g_pserver->cron_malloc_stats.allocator_allocated)
|
if (!g_pserver->cron_malloc_stats.allocator_allocated)
|
||||||
g_pserver->cron_malloc_stats.allocator_allocated = g_pserver->cron_malloc_stats.zmalloc_used;
|
g_pserver->cron_malloc_stats.allocator_allocated = g_pserver->cron_malloc_stats.zmalloc_used;
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if (g_pserver->force_eviction_percent) {
|
if (g_pserver->force_eviction_percent) {
|
||||||
struct sysinfo sysinf;
|
struct sysinfo sysinf;
|
||||||
memset(&sysinf, 0, sizeof sysinf);
|
memset(&sysinf, 0, sizeof sysinf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user