#ifndef _OPOD_RESEARCH_MEMORY_USEAGE_HEADER_H_
#define _OPOD_RESEARCH_MEMORY_USEAGE_HEADER_H_
#include <google/malloc_extension.h>
#include "common/utility/sysinfo_utility.h"
#define SHOW_MEMORY(text) \
MallocExtension::instance()->ReleaseFreeMemory(); \
LOG(INFO) << "[" << text << "]Memory used by process:\t" << SystemInfoUtility::GetMemoryUsedByProcess() << " B" << std::endl;
#define SHOW_MEMORY_STATS(text) \
do { \
MallocExtension::instance()->ReleaseFreeMemory(); \
LOG(INFO) << "[" << text << "]Memory used by process:\t" << SystemInfoUtility::GetMemoryUsedByProcess() << " B" << std::endl; \
constexpr int32_t bufSize = 1048576; \
char* bff = new char[bufSize]; \
MallocExtension::instance()->GetStats(bff, bufSize); \
LOG(INFO) << bff; \
delete bff; \
} while(0);
#endif
内存使用观察
Comments 0
Sign in to comment and like
← More postsThat’s all for now. Thanks for reading.
No comments yet.