A small (but probably non-useful) comment: I originally envisaged buffering as being a strictly file-based thing - a layer on top of file i/o, rather like dircache.
You'd "bufopen" a list of files you were planning to read and it would attempt to pre-read them into memory. You'd then "bufread" the data which could come either from the buffer (good!) or from the disk (bad, but inevitible sometimes). Then, when you're pretty sure you no longer need a file, you'd "bufclose" the buffer handle. Internally, the allocation would of course have to make judgements about discarding buffered data as and when new space was needed, using the hints given via the file type. However, it seems to have become malloc-by-proxy. :) pondlife
