malloc大内存警告环境变量改名为MEM_WARN_SIZE

This commit is contained in:
ziyue 2021-12-31 10:26:36 +08:00
parent 9cf6fea03e
commit c0afcc48e5

View File

@ -499,9 +499,9 @@ static void init_cookie(MemCookie *cookie, size_t c) {
cookie->alloc_info->addBlock(c); cookie->alloc_info->addBlock(c);
#if defined(MEM_WARING) #if defined(MEM_WARING)
static auto env = getenv("MAX_MEM_SIZE"); static auto env = getenv("MEM_WARN_SIZE");
static size_t kMaxMemSize = atoll(env ? env : "0"); static size_t s_mem_waring_size = atoll(env ? env : "0");
if (kMaxMemSize > 1024 && c >= kMaxMemSize) { if (s_mem_waring_size > 1024 && c >= s_mem_waring_size) {
print_mem_waring(c); print_mem_waring(c);
} }
#endif #endif