메모리 부족(?)으로 인한 segmentation fault 에러에 대한 질문

izlley의 이미지

저는 한양대학교 학생입니다.
질문이 있어 글을 올립니다.

[제 컴퓨터 관련 정보]
{ cpu : Intel(R) Pentium(R) 4 CPU 3.20GHz
memory: 3GB
OS : Linux Debian
커널 버젼 : 2.4.26 }

상당히 많은 메모리를 요구하는 xpw라는 실행파일을 실행시키고자 합니다.
xpw 컴파일시 code상의 error는 없다고 가정합니다.

제컴퓨터의 메모리는 3 GB 입니다.
##########################################
(bash shell)
$cat /proc/meminfo

total: used: free: shared: buffers: cached:
Mem: 3179536384 1696112640 1483423744 0 157790208 633057280
Swap: 4186595328 0 4186595328
MemTotal: 3105016 kB
MemFree: 1448656 kB
MemShared: 0 kB
Buffers: 154092 kB
Cached: 618220 kB
SwapCached: 0 kB
Active: 498532 kB
Inactive: 1001276 kB
HighTotal: 2228160 kB
HighFree: 880420 kB
LowTotal: 876856 kB
LowFree: 568236 kB
SwapTotal: 4088472 kB
SwapFree: 4088472 kB
############################################

그리고 xpw를 실행시키기 위해 필요한 메모리는 다음과 같습니다.
size 명령어를 이용하여 xpw를 실행시키는데 메모리에 띄워야할 objfile들의 크기를 보았습니다.

############################################
$size xpw

text data bss dec hex filename
931391 39580 949909244 950880215 38ad47d7 xpw

$size -A xpw

xpw :
section size addr
.interp 19 134512948
.note.ABI-tag 32 134512968
.hash 328 134513000
.dynsym 688 134513328
.dynstr 412 134514016
.gnu.version 86 134514428
.gnu.version_r 112 134514516
.rel.dyn 48 134514628
.rel.plt 264 134514676
.init 23 134514940
.plt 544 134514964
.text 907488 134515520
.fini 27 135423008
.rodata 21160 135423040
.eh_frame_hdr 36 135444200
.data 39204 135448384
.eh_frame 124 135487588
.dynamic 208 135487712
.ctors 8 135487920
.dtors 8 135487928
.jcr 4 135487936
.got 148 135487940
.bss 949909244 135488128
.comment 9017 0 <--- 이부분이 왜0 으로 나오는지
.debug_aranges 120 0 이상합니다.
.debug_pubnames 37 0
.debug_info 2851 0
.debug_abbrev 312 0
.debug_line 673 0
.debug_str 1748 0
.note 5740 0
Total 950900713

############################################

아무튼 size로 확인한 결과 xpw를 실행시키기위해서는 약 950메가의 메모리가 필요하다는 것을 알수 있었습니다.
그런데 이상하게도 3GB나 되는 제 컴퓨터에서는 xpw 를 실행시키면
segmentation fault 에러가 뜹니다. code상의 error는 없다고 확신합니다.

stack size 제한상태를 보기위해 ulimit 명령을 실행해보았습니다.
잘은 모르겠지만 unlimited 라고 나오는것을 확인하였습니다.
############################################
$ulimit -a

core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 7168
virtual memory (kbytes, -v) unlimited
############################################

3기가나 되는 제컴퓨터에서 1기가 정도의 실행파일을 실행 시키지 못하는
이유나 확인해봐야할 사항이 무엇인지 답변 부탁드립니다.

nthroot의 이미지

segmentation fault 가 발생하고 메모리가 안새는 경우를 본적이 없어서..
코드가 완벽하다고 확신을 하신다니... :?
메모리가 부족해서 할당을 못받는 경우는 다른 에러가 나오죠.

------식은이 처------
길이 끝나는 저기엔 아무 것도 없어요. 희망이고 나발이고 아무 것도 없어.

k2hyun의 이미지

nthroot wrote:
segmentation fault 가 발생하고 메모리가 안새는 경우를 본적이 없어서..
코드가 완벽하다고 확신을 하신다니... :?
메모리가 부족해서 할당을 못받는 경우는 다른 에러가 나오죠.

원츄 ^^b

더 이상 없다.

댓글 달기

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