public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: jw schultz <jw@pegasys.ws>
To: linux-kernel@vger.kernel.org
Subject: Re: malloc problem to allocate very large blocks
Date: Mon, 28 Jul 2003 02:14:50 -0700	[thread overview]
Message-ID: <20030728091450.GC1333@pegasys.ws> (raw)
In-Reply-To: <20030728083730.GB1333@pegasys.ws>

On Mon, Jul 28, 2003 at 01:37:30AM -0700, jw schultz wrote:
> On Mon, Jul 28, 2003 at 02:44:28PM +0800, Tung-Han Hsieh wrote:
> > Hello,
> > 
> > I am developing applications which requires more than 2GB memory.
> > But I found that in my Linux system the malloc() cannot allocate
> > more than 2GB memory. Here is the details of my system:
> 
> Malloc is a library function, not a syscall.
> 
> That said i'm not surprised.  Malloc front-ends sbrk and
> sometimes mmap.  Sbrk uses a ptrdiff_t to indicate the size
> desired.  ptrdiff_t is signed and on 32 bit platforms should
> be 32 bits.  Therefore, the maximum you can allocate at one
> time with sbrk is going to be 2GB.  That malloc would
> inherit this limitation is to be expected.
> 
> If you need to allocate that much memory in one chunk, don't
> use malloc.

And regarding trying to get it in multiple chunks.  That is
likely to fail with sbrk due to the way the address space is
assigned to the various memory areas.

-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw@pegasys.ws

		Remember Cernan and Schmitt

  reply	other threads:[~2003-07-28  8:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-28  6:44 malloc problem to allocate very large blocks Tung-Han Hsieh
2003-07-28  8:37 ` jw schultz
2003-07-28  9:14   ` jw schultz [this message]
2003-07-29  4:58 ` Nagendra Singh Tomar
2003-07-29  5:02   ` Nagendra Singh Tomar
2003-07-29 11:52   ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030728091450.GC1333@pegasys.ws \
    --to=jw@pegasys.ws \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox