소개
이 문서에서는 Cisco IOS® 소프트웨어 플랫폼에서 MallocLite 메모리 누수를 해결하는 방법에 대해 설명합니다.
또한 Cisco TAC(Technical Assistance Center) 케이스를 열거나 디바이스를 다시 로드하기 전에 수집해야 하는 정보를 지정합니다. 이 문서에 언급된 결과를 수집하여 신속하게 문제를 해결할 수 있도록 TAC 케이스에 첨부합니다.
배경 정보
MallocLite는 128바이트 이하의 할당에 대해 청크라고 하는 작은 고정 크기의 메모리를 할당하기 위해 메모리 관리자에서 사용됩니다. 작은 메모리 할당에는 모든 할당에 대한 블록 헤더의 오버헤드가 없습니다. 이 기능은 프로세서 메모리 풀에서만 지원됩니다.
모든 메모리 블록 헤더는 약 48바이트의 메모리를 차지하고, 가장 작은 블록은 약 24바이트의 메모리를 차지한다. 각 할당에 대해 Cisco IOS Software의 기존 접근 방식에서는 실제 데이터를 8바이트만 할당해야 하는 경우에도 최소 72바이트(48 + 24)의 메모리를 사용합니다.
MallocLite로, 이러한 오버헤드는 청크의 사용에 의해 감소될 수 있다. 청크를 관리해야 하기 때문에 여전히 약간의 오버헤드가 있습니다. 그러나 청크는 크기가 고정되어 있으므로 블록과는 다른 방식으로 관리되며 오버헤드가 적습니다.
MallocLite 메모리를 사용하여 제대로 해제하는 것은 응용 프로그램의 책임입니다. MallocLite는 메모리의 사용자를 마스크 처리합니다.
문제 해결
참고: Cisco CLI Analyzer(등록된 고객만 해당)는 특정 show 명령을 지원합니다. Cisco CLI Analyzer를 사용하여 show 명령 출력의 분석을 봅니다.
유출에 책임이 있는 애플리케이션 식별
malloclite 키워드로만 검색하면 일반적으로 기존 버그를 식별하기 어렵습니다.
이 예에서는 *MallocLite* 프로세스가 비정상적인 양의 메모리를 보유하고 있음을 보여줍니다.
#show processes memory sorted
Processor Pool Total: 1614282720 Used: 1544726580 Free: 69556140
I/O Pool Total: 313524224 Used: 115564032 Free: 197960192
PID TTY Allocated Freed Holding Getbufs Retbufs Process
0 0 0 0 1476043512 0 0 *MallocLite*
유출에 책임이 있는 정확한 애플리케이션을 파악해야 합니다. 다음과 같은 세 가지 식별 방법이 있습니다.
- 할당자 PC를 디코딩합니다.
- MallocLite 메모리 통계를 조사합니다.
- MallocLite를 비활성화합니다.
디코드 할당자 PC
MallocLite가 켜진 상태에서도, 당신은 보통 어떤 기능이 메모리를 요구했는지 볼 수 있다. 보고된 이름이 MallocLite인 경우에도 show memory allocating-process totals 명령의 출력에 다른 PC 값이 표시될 수 있습니다.
#show memory allocating-process totals
<snip>
Allocator PC Summary for: Processor
Displayed first 2048 Allocator PCs only
PC Total Count Name
0x620BE3C4 42807572 594 MallocLite
0x620ADDD4 13597308 193 MallocLite
0x60738BB0 8909824 122 MallocLite
0x620AE0E0 2060716 31 MallocLite
0x620AE10C 1982780 30 MallocLite
Cisco TAC 엔지니어는 목록의 맨 위에 있는 PC 값을 디코딩할 수 있습니다(총계가 가장 높음). 이렇게 하면 메모리 누수가 있는 응용 프로그램을 식별할 수 있습니다.
MallocLite 메모리 통계 조사
Cisco IOS 소프트웨어 릴리스 15.1T에 추가된 개선 사항 중 새로운 CLI는 각 PC에서 할당한 MallocLite 메모리의 요약을 표시합니다. show memory lite-chunks 명령은 대량의 MallocLite 블록을 사용 중인 애플리케이션을 식별하는 데 도움이 될 수 있습니다.
show memory lite-chunks { statistics | totals } { summary { pool | { all | pool } } }
show memory lite-chunks 명령에 대한 자세한 내용은 명령 참조를 참조하십시오.
CLI : show memory lite-chunks totals
DESC : Summary of all pools, based on alloc pc.
This cli can be used to find the alloc_pc which is using large amount memory
allocated from all mlite pools
CLI : show memory lite-chunks statistics
DESC : Displays number of allocated & free mlite chunks
CLI : show memory lite-chunks summary pool pool
DESC : Show summary of particular mlite pool
This cli can be used to find the alloc_pc which is using large amount of memory
in individual mlite pool
CLI : show memory lite-chunks summary pool all
DESC : Show individual summary of all mlite pools
CLI : show memory lite-chunks pool pool
DESC : Show All chunk elements in the specified pool
CLI : show memory lite-chunks pool all
DESC : show all chunk elements in all mlite pools
이 명령의 출력 예는 다음과 같습니다.
#show memory lite-chunks ?
pool Malloc lite pool
statistics Malloc lite statistics
summary Malloc Lite summary
totals Malloc Lite Allocating totals
#show memory lite-chunks statistics
Pool Inuse Free
8-Bytes 140 1904
20-Bytes 173 1313
44-Bytes 171 791
68-Bytes 24 687
96-Bytes 26 519
128-Bytes 20 410
#show memory lite-chunks totals
PC Total Count
26067AE0 2112 33
2269E68C 1932 29
2269FACC 1664 29
2269F964 1664 26
2269FA9C 1580 29
26067FB4 1360 34
23CD2A0C 1036 7
#show memory lite-chunks pool ?
128-Bytes 128 bytes pool
20-Bytes 20 bytes pool
44-Bytes 44 bytes pool
68-Bytes 68 bytes pool
8-Bytes 8 bytes pool
96-Bytes 96 bytes pool
all all pools
#show memory lite-chunks summary pool 8
8 bytes pool
PC Total Count
2269FB10 812 29
23612084 700 25
2269F9F8 700 25
2269F9EC 700 25
TAC 엔지니어는 총계가 가장 높은 PC 값을 디코딩하고 메모리 누수가 발생하는 애플리케이션을 식별할 수 있습니다.
MallocLite 비활성화
MallocLite 기능은 기본적으로 활성화되어 있습니다. MallocLite 누수를 조사하려면 MallocLite를 비활성화할 수 있습니다.
(config)#no memory lite
누출된 메모리는 다음 다시 로드될 때까지 MallocLite에 남아 있습니다. 그러나 show processes memory sorted 및 show memory allocating-process totals 명령을 사용하여 추가 누수를 모니터링할 수 있습니다. 그 유출은 이제 실제 과정 하에 나타날 것이다.
디바이스에서 메모리가 매우 부족한 경우 메모리를 해제하려면 컨피그레이션을 저장하고 디바이스를 다시 로드해야 합니다.
#wr
#reload
시간이 지남에 따라 메모리가 다시 고갈될 수 있으므로 show processes memory sorted 및 show memory allocating-process totals 명령을 사용하여 해당 시점으로부터의 메모리 사용량을 모니터링합니다.
참고: no memory lite 명령으로 MallocLite를 효과적으로 비활성화하고 디바이스를 다시 로드하면 show memory lite-chunks 명령의 출력은 비어 있습니다.
memory lite 명령에 대한 자세한 내용은 명령 참조를 참조하십시오.