Re: Big malloc's.

David S. Miller (
Mon, 10 Feb 1997 19:14:51 -0500

Date: Mon, 10 Feb 1997 13:44:51 +0200 (SAT)
From: John Carter <>

Suppose I want to move through a _lot_ of data quickly. A really
big file (up to several times the size of memory+swap). Typically I
malloc() a BIG array, read() the file into that array and off I
go. If the array is too big, I start swapping like mad. Slow.

Thus its better if I chop it into buffers. The question is, how big
a buffer. The smaller the buffer, the more read()'s and the more
fiddling with buffer boundary conditions I do. Too big a buffer and
I start swapping.

Why not use mmap?