Bugs item #1177964, was opened at 2005-04-06 19:55
Message generated for change (Settings changed) made by zypher
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1177964&group_id=5470
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
>Priority: 7
Submitted By: Folke Lemaitre (zypher)
Assigned to: Nobody/Anonymous (nobody)
Summary: Iterator on Fileobject gives no MemoryError
Initial Comment:
The following problem has only been tested on linux.
Suppose at a certain time that your machine can
allocate a maximum of X megabytes of memory. Allocating
more than X should result in python MemoryErrors. Also
suppose you have a file containing one big line taking
more than X bytes (Large binary file for example).
In this case, if you read lines from a file through the
file objects iterator, you do NOT get the expected
MemoryError as result, but an empty list.
To reproduce, create a file twice as big as your
machines memory and disable the swap.
If you run the following code:
# import os.path
#
# def test(input):
# print "Testing %s (%sMB)"%(repr(input),
os.path.getsize(input)/(1024.0*1024.0))
# count = 0
# for line in open(input):
# count = count + 1
# print " >> Total Number of Lines: %s"%count
#
# if __name__ == "__main__":
# test('test.small')
# test('test.big')
you'll get something like:
# [EMAIL PROTECTED] devel $ python2.4 bug.py
# Testing 'test.small' (20.0MB)
# >> Total Number of Lines: 1
# Testing 'test.big' (2000.0MB)
# >> Total Number of Lines: 0
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1177964&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com