本文介绍了怀疑内存泄漏时需要收集的输出的列表。
大多数情况下的内存泄漏是一个非常缓慢的过程,此时,需要进行广泛的日志分析。
我们可能需要多个输出样本,以进行分析及了解哪个内存部分受到影响。
内存监控工具
S4810、MXL 和 Z9000 9.1(0.0P6+) 版本中集成了内存监控工具。 此工具可以捕获有助于解决潜在内存泄漏的数据分配使用详情。 可通过控制台或远程登录会话访问内存监控工具。
1:启用内存监控工具
要启用内存监控工具。
使用示例:
remote-exec cp f10mc -i 0x87
示例:
命令:
Z9000#remote-exec cp f10mc -i 0x87
系统响应:
f10mc -i 0x87
f10mc:已经为 malloc、pool、pool_cache 初始化,使用 F10 分配的过滤器
SStk-0 #
2:收集数据
2a:收集定期一般内存数据
分多日,每日定期收集数据(4 到 6 小时的间隔)。 要收集输出,执行以下命令。 以下命令显示系统的一般内存详情。 每次收集输出时,输出中的循环数将增加一。
使用示例:
remote-exec cp f10mc -r 0
示例:
命令:
Z9000#remote-exec cp f10mc –r 0
系统响应:
f10mc -r 0
{
----------------------
#### This cycle: 46176 bytes held by 56 allocations ####
M: 1888(16); +2329280(18371), -2329280(18371)
P: 0(0); +0(0), -0(0)
PC: 44288(40); +3053056(11226), -3053056(11226)
#### Since MCInit: 708902 bytes held by 2112 allocations ####
M: 52006(1338); +110122134(928732), -110070128(927394)
P: 0(0); +0(0), -0(0)
PC: 656896(774); +148369408(548411), -147712512(547637)
}
SStk-0 #
除了内存监控工具输出以外,还可能请求以下输出。
相关命令:
remote-exec cp top -b -o res all
remote-exec cp netstat –m
remote-exec cp vmstat –s
show process memory
show process memory management
show memory
show clock
2b:收集详细的内存数据
在“remote-exec cp f10mc –r 0”命令的收集期结束后,将请求以下命令的输出。 以下命令将提供系统的精确内存详情。
使用示例:
remote-exec cp f10mc -r 1
示例:
命令:
Z9000#remote-exec cp f10mc -r 1
系统响应:
f10mc -r 1
{
PC:mbpl:0xC71F5200:256:3
PC:mclpl:0xD7C24800:2048:3
PC:mbpl:0xC71F3500:256:3
{output truncated}
PC:mbpl:0xCAFC7F00:256:2
PC:mclpl:0xD7C4D000:2048:2
----------------------
#### This cycle: 286144 bytes held by 266 allocations ####
M: 3520(16); +21362(417), -20514(415)
P: 0(0); +0(0), -0(0)
PC: 282624(250); +1129472(2200), -1126912(2197)
#### Since MCInit: 599392 bytes held by 542 allocations ####
M: 5216(20); +67838(1335), -62622(1315)
P: 0(0); +0(0), -0(0)
PC: 594176(522); +3513088(6660), -2918912(6138)
}
SStk-0 #
工程设计人员将评估收集的数据,并详细介绍如何收集有助于发现内存泄漏来源的进一步信息。 请求的输出将用于可疑内存分配:
使用示例:
remote-exec cp f10mc –c 0x
示例:
命令:
Z9000# remote-exec cp f10mc –c 0xCE0DDD00
系统响应:
f10mc -c 0xCE0DDD00
PC:mbpl:0xCE0DDD00:256:2> 0xC0100EAD 0xC033DA54 0xC0137ADE 0xC0136DD0 0xC0142682 0xC013FA17 0xC0148C38 0xC037C808 0xC037BE3F 0xC09B805A
call trace:
0xC0100EAD in Xsoftintr
0xC033DA54 in softint_dispatch
0xC0137ADE in ipintr
0xC0136DD0 in ip_input
0xC0142682 in tcp_input
0xC013FA17 in syn_cache_get
0xC0148C38 in tcp_template
0xC037C808 in m_gethdr
0xC037BE3F in m_get
0xC09B805A in f10MC_pool_cache_get_paddr
SStk-0 #
3:禁用内存监控
要在数据审查完成后禁用内存监控工具..
使用示例:
remote-exec cp f10mc -i 0x0
示例:
命令:
Z9000#remote-exec cp f10mc -i 0x0
系统响应:
f10mc -i 0x0
f10mc: deinitialized
SStk-0 #