RE: Memory Allocation

From: David Schwartz
Date: Wed Apr 18 2007 - 00:47:59 EST



> My test machine is a Dell Precision 490 with dual 5140 processors and
> 3GB of RAM. If I reduced kMaxSize to (2048 * 2048 * 236) is works.
> However, I need to allocate an array of char that is (2048 * 2048 * 256)
> and maybe even as large at (2048 * 2048 * 512).
>
> Obviously I have enough physical memory in the box to do this. However,
> I suspect that I'm running out of page table entries. Please, correct
> me if I'm wrong; but if I allocate (2048 * 2048 * 236) it work. When I
> increment to 256 or 512 it fails and it is my suspicion that I just
> don't have enough more in kernel memory to allocate this much memory in
> user space.

It is unreasonable to expect single allocations this large to succeed on a
32-bit OS. Either get a 64-bit OS or use a number of smaller allocations.

You may want to use mmap'ed files instead of malloc'ed memory. You can them
mmap however many files you can at once, and unmap and remap them as needed.

DS



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/