Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

Le jeudi 11 septembre 2008 à 16:01 +0200, Anthon van der Neut a écrit :
> The thing however was resolved by reading multiple smaller chunks indeed
> 1Mb if the filesize exceeds 1Mb (in the latter case the original read()
> is done.

It's too complicated. Just use chunks in all cases (even small files)
and you are done. There should be no visible performance downside to
doing so.

Using fixed-size chunks to read binary data from a file of an unknown
size isn't a Python-specific idiom, really. It's the same in C, C++,
PHP, etc.

----------
title: file read preallocs 'size' bytes which can cause memory problems -> file 
read preallocs 'size' bytes which can cause memory      problems

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3531>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to