2014-02-20 1 views
0

Valgrind를 사용하여 메모리 누수를 확인하는 데 문제가 있습니다. (또한 fprintf에 segfault가 있음을 이해하고 있지만) 몇 가지 방법으로 초기화되지 않은 값이 사용 된 것으로 보입니다. 내 코드에서 오지 않는다. 디버거를 사용하여 디버깅을 처음 사용하기 때문에 새로운 기능이 누락 될 수 있습니다.OpenMP 초기화되지 않은 값과 Valgrind

나는 Valgrind가 내 기본 GCC OpenMP (http://valgrind.org/docs/manual/drd-manual.html#drd-manual.openmp)와 편하지 않다는 것을 알고 있지만, 나는 그것을 사용하고있다. 내 코드를 -pedantic -Wall -static -O0 -g -fopenmp과 함께 오류가 없다.

valgrind --leak-check=full --track-origins=yes --error-limit=no --log-file=./logfile ~/developing/trunk/gop.exe 

으로 Valgrind의 실행시

그러나, 나는

==5944== Memcheck, a memory error detector 
==5944== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. 
==5944== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info 
==5944== Command: /home/henrique/developing/trunk/gop.exe 
==5944== Parent PID: 11534 
==5944== 
==5944== Syscall param set_robust_list(head) points to uninitialised byte(s) 
==5944== at 0x4983DF: __pthread_initialize_minimal (nptl-init.c:369) 
==5944== by 0x498920: (below main) (libc-start.c:146) 
==5944== Address 0x4000bf0 is not stack'd, malloc'd or (recently) free'd 
==5944== Uninitialised value was created 
==5944== at 0x513A6A: brk (brk.c:32) 
==5944== by 0x4ED4EB: sbrk (sbrk.c:54) 
==5944== by 0x498C13: __libc_setup_tls (libc-tls.c:150) 
==5944== by 0x498366: __pthread_initialize_minimal (nptl-init.c:296) 
==5944== by 0x498920: (below main) (libc-start.c:146) 

로 시작 그리고 유사한 경고 (수천!)을 많이 받고 내 로그 파일에 경고를 많이 얻을 아래

==5944== Conditional jump or move depends on uninitialised value(s) 
==5944== at 0x4EF546: __linkin_atfork (register-atfork.c:119) 
==5944== by 0x4BA5D3: ptmalloc_init (arena.c:388) 
==5944== by 0x4BB283: malloc_hook_ini (hooks.c:32) 
==5944== by 0x51842B: _dl_init_paths (dl-load.c:732) 
==5944== by 0x4F097A: _dl_non_dynamic_init (dl-support.c:268) 
==5944== by 0x4F1352: __libc_init_first (init-first.c:83) 
==5944== by 0x49895B: (below main) (libc-start.c:165) 
==5944== Uninitialised value was created 
==5944== at 0x513A6A: brk (brk.c:32) 
==5944== by 0x4ED4EB: sbrk (sbrk.c:54) 
==5944== by 0x498C13: __libc_setup_tls (libc-tls.c:150) 
==5944== by 0x498366: __pthread_initialize_minimal (nptl-init.c:296) 
==5944== by 0x498920: (below main) (libc-start.c:146) 

Valgrind를 컴파일하거나 실행할 때 뭔가가 누락 되었습니까? 또는 내 코드가 실제로 이러한 모든 오류가 있습니까?

대단히 감사합니다!

답변

0

일부 라이브러리에는 표시하고있는 것과 같은 경고가 많이 있습니다. 여기에 파일 이름이 표시되는 곳에서 귀하의 코드에서 왔다고 생각하지 않습니다.

당신은 segfault를 위해 다른 곳을 봐야 할 것입니다. gdb로 실행 해보고 어디서 멈추는 지 살펴보고 오류를 둘러싼 값을 출력하여 현재 상태를 확인하십시오.

희망 하시겠습니까?