mongodb/mongo-python-driver — pull request #142 by TomasB (2012-09-22 01:52:42+00:00)
Title: MemoryError while retrieving large collection

This is the issue we experience on windows machines:
Python version v2.7.2
Mongo v2.0.7 (running on ubuntu)
```
Stack:
for user in all_users:
File "C:\Python27\lib\site-packages\pymongo\cursor.py", line 778, in next
if len(self.__data) or self._refresh():
File "C:\Python27\lib\site-packages\pymongo\cursor.py", line 742, in _refresh
limit, self.__id))
File "C:\Python27\lib\site-packages\pymongo\cursor.py", line 666, in __send_message
**kwargs)
File "C:\Python27\lib\site-packages\pymongo\connection.py", line 907, in _send_message_with_response
return self.__send_and_receive(message, sock_info)
File "C:\Python27\lib\site-packages\pymongo\connection.py", line 885, in __send_and_receive
return self.__receive_message_on_socket(1, request_id, sock_info)
File "C:\Python27\lib\site-packages\pymongo\connection.py", line 877, in __receive_message_on_socket
return self.__receive_data_on_socket(length - 16, sock_info)
File "C:\Python27\lib\site-packages\pymongo\connection.py", line 858, in __receive_data_on_socket
chunk = sock_info.sock.recv(length)
MemoryError
```
At this point I am not even convinced that this issue is pymongo, and not python, but the change seems to fix the issue without any other bad side affects. Please do not hesitate to request for more info, I'm quite eager to have it resolved in mainstream of driver's code.