相关疑难解决方法(0)

C中的问题使用记忆

请帮助:)操作系统:Linux

在"sleep(1000);"中,此时"top(显示Linux任务)"给我写了7.7%MEM使用.valgrind:没发现内存泄漏.

我明白了,写得正确,所有malloc结果都是NULL.但为什么在这个时候"睡觉"我的程序不会减少记忆?遗失了什么?

抱歉我的英文不好,谢谢


~ # tmp_soft
For : Is it free??  no
Is it free??  yes
For 0 
For : Is it free??  no
Is it free??  yes
For 1 
END : Is it free??  yes
END 

~ #top
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                
23060 root      20   0  155m 153m  448 S    0  7.7   0:01.07 tmp_soft    
Run Code Online (Sandbox Code Playgroud)

完整来源:tmp_soft.c

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

struct cache_db_s
{
 int       table_update;
 struct    cache_db_s …
Run Code Online (Sandbox Code Playgroud)

c linux malloc free cc

0
推荐指数
1
解决办法
3221
查看次数

标签 统计

c ×1

cc ×1

free ×1

linux ×1

malloc ×1