Re: malloc problem to allocate very large blocks

From: jw schultz (jw@pegasys.ws)
Date: Mon Jul 28 2003 - 04:14:50 EST


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 - 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/



This archive was generated by hypermail 2b29 : Thu Jul 31 2003 - 22:00:35 EST