C로 색인작업중인데 메모리가 문제 인거 같은데;;

xe11oss의 이미지

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)
요렇게 나오는 부분도 있는데
어떻게 해결해야할까요?

오호라의 이미지

free( buf );
free( buf );

코드상에 두번 free() 해주는 곳을 찾으면 될 것같습니다.

Hello World.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.