[lkml]   [2003]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
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:

Remember Cernan and Schmitt
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:47    [W:0.079 / U:0.800 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site