调整内存限制

This commit is contained in:
13038267101 2022-11-24 20:30:18 +08:00
parent 919d156f5e
commit 24f11ff619
2 changed files with 5 additions and 3 deletions

View File

@ -2394,11 +2394,13 @@ int hg_scanner::save_usb_data(std::shared_ptr<tiny_buffer> data)
}
else
{
while (Memoryusae > memory_size_)
int num = 0;
while (Memoryusae > memory_size_ && user_cancel_ && num < 20)//三个条件以防止卡死
{
num++;
std::this_thread::sleep_for(std::chrono::milliseconds(500));
Memoryusae = hg_log::GetAppMemoryUsage();
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Memory Usage is Too big:%d ,Please wait -_- ...", Memoryusae);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Memory Usage is Too big:%f ,Please wait -_- ...\r\n", Memoryusae);
}
imgs_.Put(data);
if (wait_img_.is_waiting())

View File

@ -28,7 +28,7 @@
#include <algorithm>
#include <mutex>
#include "ini_file.h"
#define VMRSS_LINE 22
#define VMRSS_LINE 21 //实际物理内存使用率
#define MAX_LOG_FILE_SIZE 100 * 1024 * 1024
#ifdef _INTSIZEOF
#undef _INTSIZEOF