lkml.org 
[lkml]   [2003]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: malloc problem to allocate very large blocks
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.

--
________________________________________________________________
J.W. Schultz Pegasystems Technologies
email address: jw@pegasys.ws
Remember Cernan and Schmitt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:47    [from the cache]
©2003-2011 Jasper Spaans