[질문] MySQL client run out of memory

hurryon의 이미지

C API 을 이용해 MySQL 을 접속하는 프로그램입니다. 일단은 사용되는
테이블의 레코드수 와 테이블 구조는 다음과 같습니다.

mysql> select count(*) from saup;
+----------+
| count(*) |
+----------+
|   191435 |
+----------+
1 row in set (0.00 sec)

mysql> select count(*) from iif;
+----------+
| count(*) |
+----------+
|   129711 |
+----------+
1 row in set (0.00 sec)

mysql> desc saup;
+----------+----------+------+-----+---------+-------+
| Field    | Type     | Null | Key | Default | Extra |
+----------+----------+------+-----+---------+-------+
| sequence | char(13) |      | PRI |         |       |
| content1 | char(60) | YES  |     | NULL    |       |
| content2 | char(40) | YES  |     | NULL    |       |
| etc      | char(40) | YES  |     | NULL    |       |
| code     | char(5)  | YES  |     | NULL    |       |
+----------+----------+------+-----+---------+-------+
5 rows in set (0.00 sec)

mysql> desc iif;
+---------+--------------------+------+-----+---------+-------+
| Field   | Type               | Null | Key | Default | Extra |
+---------+--------------------+------+-----+---------+-------+
| keyword | varchar(18) binary |      | PRI |         |       |
| did     | int(10) unsigned   |      | PRI | 0       |       |
| weight  | float              | YES  |     | NULL    |       |
+---------+--------------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql>

간단한 테이블이고 레코드 수도 많지 않습니다. 또한 작업 내용이
위의 테이블에서 단지 간단한 select 문으로 하나의 레코드씩
받아와 작업을 하고 있습니다.

문제는 프로그램이 전체 레코드의 20% 정도 진행되다가 다음과 같은
메세지을 뿌리면서 죽어 버립니다.

Out of memory (Needed 8164 bytes)
MySQL client run out of memory

밑에는 작업시간입니다. time 을 이용한 결과죠.

real    92m22.545s
user    34m32.580s
sys     27m34.700s

어쨌든 위와 같은 작업 시간이 나오는건 당연한것이지만

Out of memory (Needed 8164 bytes)
MySQL client run out of memory

라는 메세지가 나온것이

1. 하드웨어의 메모리 부족
2. /etc/my.cnf 파일의 셋팅 미숙
3. 프로그램 작성상의 메모리 누수나 해제 미숙

위의 3가지 경우에 어떤쪽에 가까운지요? 소스 조금 고치고 테스트 하나
하는데 워낙 시간이 많이 걸려서 확실한 원인을 알고 싶어서 입니다.

일단은 소스을 좀 변경하고 /etc/my.cnf 을 기존에는 medium 을 썼는데
large 로 바꾸고 돌리고 있습니다만...으흠...

고견을 부탁합니다.

maximus의 이미지

프로그램 작성 미숙인거 같습니다....

=================================
:: how about a cup of tea ? ::
=================================

hurryon의 이미지

/etc/my.cnf 파일을 medium 에서 large로 바꾸니 해결이 되었습니다. 물론
소스수준에서도 mysql_free_result() 함수의 위치을 좀 더 적절하게
변경을 했지만요

:-)

댓글 달기

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