malloc 에 대한 궁금중.

kicom95의 이미지

안녕하세요 ^^

다름이 아니라 malloc 에 대한 질의를 드리려 합니다.

제가 솔라리스에서는 malloc 을 할때 메모리를

1G 도 할당을 해보고 리눅스도 마찬가지인데.....

잘 되더던데...

AIX 5.1 , 5.2 에서는

ptr = malloc(1024*1024*256) ==> 이건 실패더군요

그런데

ptr = malloc(1024*1024*200) ==> 문제 없이 돌아가던데

물론 이 함수 다음의 메모리 할당 은 안되더군요 -_-;;

각각의 OS 마다 최대 할당 메모리 크기가 따로 있는지요?

아니면 뭐라도 define 을 해야하나요? 대용량 메모리 할당

받으려면 답답해요 -_-;;

제가 짠 프로그램이 메모리가 좀 필요한건데 ^^

kicom95의 이미지

자문 자답을 해야 겠네요 ^^

인터넷을 찾아 보니... 이런 내용이 있네요

from the users point of view the memory of a program is divided into the
data and the stack region. As far as I know, the AIX compilers limit the
data region size of 32bit executables to 128 MByte, and the stack size
to 32 MByte. To increase the sizes to their maximum value possible for
32bit exes, one links with

-bmaxdata:0x80000000 -bmaxstack:0x10000000

or patches an executable with ldedit, and sets the corresponding
ulimits.
When the data size is too small, malloc fails at runtime with an
appropriate error message. When the stack size is too small, the program
usually crashes with signal 11.

Specifying more than 2 GByte for data size, or more than 256 MByte for
stack size is useless for 32bit executables on AIX and has no effect.

Depending on the data layout for a given application, there exist two
possibilities to overcome memory problems:
1. switch to the 64bit address model
2. use more MPI tasks

The 64bit exes are usually a bit slower than the 32bit executables,
since 64bit pointers have to become fetched from memory or the caches
instead of 32bit pointers, which is a problem of bandwidth.

Using more MPI tasks if memory is not enough was usually a good choice
for Cray T3E and related platforms with good interconnects and memory
bandwidth, if an application distributes data among MPI tasks.

결국 컴파일 옵션을 바꾸니 되는듯 합니다 ^^

나중에 저와 같은 문제를 만나시면 모든 분들 해결 바랍니다.

gcc mem_test.c -Wl,-bmaxdata:0x80000000

가자 해외로 ~ .. 돈 벌러.

댓글 달기

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