C로 색인작업중인데 메모리가 문제 인거 같은데;;
gdb 결과가 이렇습니다.
*** glibc detected *** double free or corruption (out): 0x082b4058 ***
Program received signal SIGABRT, Aborted.
0x004497a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
(gdb) bt
#0 0x004497a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0048a815 in raise () from /lib/tls/libc.so.6
#2 0x0048c279 in abort () from /lib/tls/libc.so.6
#3 0x004becca in __libc_message () from /lib/tls/libc.so.6
#4 0x004c555f in _int_free () from /lib/tls/libc.so.6
#5 0x004c593a in free () from /lib/tls/libc.so.6
#6 0x00115638 in _gdbm_read_entry () from /usr/lib/libgdbm.so.2
#7 0x001157ca in _gdbm_findkey () from /usr/lib/libgdbm.so.2
#8 0x001136bf in gdbm_fetch () from /usr/lib/libgdbm.so.2
#9 0x08049290 in GdbmFetch (db_Temp=0x80ae080, m_Key=0xbffff500, m_KeySize=4, m_Content=0xbffff4ec,
m_ContentSize=0xbffff4f0) at DatabaseConnector.c:99
#10 0x08049b6e in LoadMaxFreq (m_DocID=1314) at DatabaseHandler.c:352
#11 0x0804ad1d in ComputeWeight () at Learner.c:723
#12 0x08049fb2 in main (argc=2, argv=0xbffffa54) at Learner.c:146
검색을 하고 찾아보던중에
export MALLOC_CHECK_=0 이옵션을 하면
임시방편이지만 해결하수있다해서 /etc/profile에 추가도 해보고
이것 적것해봤는데 안되네요
그래서 valgrind를 해봤는데
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 14 from 1)
--24265--
--24265-- supp: 14 Ubuntu-stripped-ld.so
==24265== malloc/free: in use at exit: 0 bytes in 0 blocks.
==24265== malloc/free: 4 allocs, 4 frees, 789 bytes allocated.
==24265==
==24265== All heap blocks were freed -- no leaks are possible.
--24265-- memcheck: sanity checks: 0 cheap, 1 expensive
--24265-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
--24265-- memcheck: auxmaps: 0 searches, 0 comparisons
--24265-- memcheck: secondaries: 12 issued (768k, 0M)
--24265-- memcheck: secondaries: 23 accessible and distinguished (1472k, 1M)
--24265-- tt/tc: 4,059 tt lookups requiring 4,098 probes
--24265-- tt/tc: 4,059 fast-cache updates, 3 flushes
--24265-- translate: new 1,921 (40,937 -> 656,143; ratio 160:10) [0 scs]
--24265-- translate: dumped 0 (0 -> ??)
--24265-- translate: discarded 6 (141 -> ??)
--24265-- scheduler: 41,768 jumps (bb entries).
--24265-- scheduler: 0/2,285 major/minor sched events.
--24265-- sanity: 1 cheap, 1 expensive checks.
--24265-- exectx: 30,011 lists, 16 contexts (avg 0 per list)
--24265-- exectx: 22 searches, 6 full compares (272 per 1000)
--24265-- exectx: 0 cmp2, 39 cmp4, 0 cmpAll
에러가 없는건지
malloc free할떄 마다 찍어주는데서는
--24265-- free(0x40183C0)
--24265-- free(0x4018348)
[FAILURE: -1]
--24265-- free(0x0)
--24265-- free(0x0)
--24265-- free(0x0)
--24265-- free(0x0)
요렇게 나오는 부분도 있는데
어떻게 해결해야할까요?
double free
코드상에 두번 free() 해주는 곳을 찾으면 될 것같습니다.
Hello World.
댓글 달기