반응형


Take a look at document #A4678152 ("Comparing page size for vmstat, top, glance, ps -el").


1. Top reports free memory in 1kb chunks so to get them to match you must divide tops free amount by 4 to get the true number of 4kb pages free and have it match vmstat. In other words, top reports in 1kb pages so these numbers must be multiplied by 4 to get 4kb kernel pages numbers.

2. For vmstat, avm (active virtual pages) and free (size of the free list) memory are reported in 4kb pages sizes.

3. Glance reports 1kb page sizes. This number will often be significantly different from ps -el since glance reports usage of shared memory also.

From the Glance help window for RSS (* PROC_MEM_RES): The number of KB of resident memory for the process. This consists of text, data, stack, as well as the process' portion of shared memory. This value is similar to the SZ field of the ps -el command, except that the ps command shows only data, stack, and text areas, and it reports their sizes in page units rather than KB. On some systems ps reports the virtual rather than
resident size.

4. ps -el reports in 4kb kernel page sizes.



vsz = The size in kilobytes (1024 byte units) of the core image of the process. See column sz, above.
sz = The size in physical pages of the core image of the process, including text, data, and stack space.

Glance RSS = RSS(* PROC_MEM_RES): The number of KB of resident memory for the process. This consists of text, data, stack, as well as the process' portion of shared memory. This value is similar to the SZ field of the ps -el command, except that the ps command shows only data, stack, and text areas.

반응형

'OS > HP-UX::' 카테고리의 다른 글

HP-UX depot 패키지 설치  (0) 2014.06.11
HP-UX 11.11 gcc 설치  (0) 2014.06.11
HP-UX Thread dump 및 프로세스 분석 툴 Glance  (0) 2012.08.22
HP-UX 컴파일러 관련 정보  (0) 2011.12.01
반응형
출처 : http://nicejoo.blogspot.kr/2012/02/memory-leak.html
출처 : http://stormaa.tistory.com/5
출처 : http://ysoftman.blogspot.kr/2012/05/linux-valgrind.html
출처 : http://www.solanara.net/solanara/memoryleak ( 다양한 릭 디텍팅 방식 가이드)
출처 : http://h21007.www2.hp.com/portal/download/files/unprot/devresource/Tools/wdb/doc/011310/memdebug-updated.pdf (WDB)
-----------------------------------------------------------------------------------------------

1. Valgrind 설치

wget http://www.valgrind.org/downloads/valgrind-3.3.0.tar.bz2(새 창으로 열기)
tar xvfj valgrind-3.3.0.tar.bz2
cd valgrind-3.3.0
./configure
make
make install

2. Valgrind 테스트
valgrind --leak-check=yes main

3. 간단 실행법
valgrind --tool=memcheck --leak-check=full --show-reachable=yes --log-file=memcheck.txt [프로그램] [실행인자들...]
valgrind --leak-check=full --log-file=memcheck.txt -v --error-limit=no [프로그램경로] [인자]


--leak-check=full : 메모릭에러가 날 경우 소스파일명과 라인위치 출력

               이 옵션을 사용할려면 디버깅컴파일을 해야합니다. (컴파일시 -g 옵션)
--log-file : 체크결과를 저장할 로그파일명


// 항목별 메모리 블럭 누수를 확인 할 수 있다.
definitely lost: 블럭 해제(free) 코드를 사용하지 않은 명백한 메모리 누수가 있음을 나타낸다.
indirectly lost: 블럭을 가르키는 포인터를 상실한 경우로 예를들어 이진트리의 루트노드를 잃어버리면 자식 노드 블럭 포인터를 간접적으로 잃어버리는 경우를 나타낸다.
possibly lost: 내부 포인터가 해제 되지 않은 경우로, 자신이 모르는 내부 포인터인 경우 신경 쓰지 않아도 된다.
still reachable: 메모리 블럭을 아직까지 사용하고 있는 경우, 프로그램 종료되기전에 해제해야될 메모리 블럭을 나타낸다.


반응형

'UTIL > Leak Detect' 카테고리의 다른 글

Monitoring and Tuning Memory Use  (0) 2015.08.17

+ Recent posts