eFence를 사용하려면

diene의 이미지

메모리 누수를 체크하기 위해서 debug tool을 사용하려는데

eFence를 많이 사용한다고 하더군요.

eFence관련 자료를 찾아봐도 정확한 사용법을 잘 모르겠습니다.

전에 yamd를 사용해봤는데, 정확히 어느 부분에서 new를 했고, delete를 하

는지가 안나오고 allocation, deallocation만 나오기 때문에 프로그램 전체를

따라가면서 확인을 해야하더군요.

혹 eFence도 그렇게 나오는 것인가요?

USAGE
Link your program with the library libefence.a . Make
sure you are not linking with -lmalloc, -lmallocdebug, or
with other malloc-debugger or malloc-enhancer libraries.
You can only use one at a time. If your system adminis-
trator has installed Electric Fence for public use, you'll
be able to use the -lefence argument to the linker, other-
wise you'll have to put the path-name for libefence.a in
the linker's command line. Some systems will require spe-
cial arguments to the linker to assure that you are using
the Electric Fence malloc() and not the one from your C
library. On AIX systems, you may have to use the flags
-bnso -bnodelcsect -bI:/lib/syscalls.exp
On Sun systems running SunOS 4.X, you'll probably have to
use -Bstatic.

Run your program using a debugger. It's easier to work
this way than to create a core file and post-mortem debug
it. Electric Fence can create huge core files, and some
operating systems will thus take minutes simply to dump
core! Some operating systems will not create usable core
files from programs that are linked with Electric Fence.
If your program has one of the errors detected by Electric
Fence, it will get a segmentation fault (SIGSEGV) at the
offending instruction. Use the debugger to locate the
erroneous statement, and repair it.

찾아보긴하였는데 정확히 사용법을 잘 모르겠습니다.

cinsk의 이미지

매우 간단합니다.

단순히 link할때 -lefence option만 주면 됩니다.

그러면 대부분의 boundary problem은 즉시 segmentation fault를 내기 때문에, gdb의 backtrace 명령으로 어디가 잘못되었는지 쉽게 알 수 있습니다.

saxboy의 이미지

mpatrol 을 한번 써보세요. leak의 경우에는 memprof 를 사용하시면 편리합니다.

amister의 이미지

efence, memprof, dmalloc, valgrind...

돈 되시면 purify... ;)

efence의 경우는 메모리를 굉장히 많이 쓰는 어플의 경우 자주 OOM이 나더군요.
다른 것도 마찬가지겠지만.. 좀 더 심한 듯 합니다.

적절한 수준의 어플 디버깅할 때에는 개인적으로 valgrind가 제일 편하다고 느낍니다. 크게 상관없는 메세지들로 도배가 될때도 있어서 혼란을 줄때도 있긴 하지만...

ulra의 이미지

안녕하세요.
electricfence 라이브러리와 함께 컴파일 된 것을
gdb로 돌렸습니다.
efence 테스트용으로 간단하게 만들어서
원하는 부분에서 segment fault를 냈습니다.
문제는 gdb가 종료가 안되네요 ㅜ.ㅜ
"cannot find thread 1024 : generic error" 라는 메세지가 나오고 종료가 안됩니다. 어떻게 해야 하나요?

gdb 는 redhat 7.2 CD에 있는 것이고요.
efence는 2.1.13-0.1 버전입니다.

OTL 즐!!!! (좌절 금지!!!)

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.