我们经常在优化相机的内存,性能调优或者其相关引起的稳定性流程问题时,需要来针对系统内存大小判断来做camera flow相关客制化修改;
内存检测方法参考如下:
代码语言:javascript复制BOOL GetLowMemorystate()
{
std::string s_file = "proc/meminfo";
char buf_file[MEMINFO_FILE_BUFFER_SIZE];
char buf_mem[MEMORY_SIZE_BUFFER];
FILE *F = fopen(s_file.c_str(), "r");
if (F != 0)
{
for(int i = 0; i < MEMAVAILABLE_LINE_IN_FILE; i )
{
fgets(buf_file, sizeof(buf_file), F);
}
memcpy(buf_mem,&buf_file[17], MEMORY_SIZE_BUFFER);
buf_mem[MEMORY_SIZE_BUFFER - 1] = '