I wrote a python script that I use to download a large number of video files (50-400 MB each) from an HTTP server. So far, it has worked well on long download lists, but for some reason it rarely has a memory error.
The device has about 1 GB of RAM, but I do not think that it ever exceeded the amount of RAM when running this script.
I controlled the memory usage in the task manager and perfmon, and it always behaves the same from what I saw: it slowly increases at boot time and then returns to its normal level after the download is completed (there are no small leaks that creep in or something in like that).
The download method is that it creates a file that remains at 0 KB until the download is complete (or the program fails), then it immediately writes the entire file and closes it.
for i in range(len(urls)): if os.path.exists(folderName + '/' + filenames[i] + '.mov'): print 'File exists, continuing.' continue
Here is the stack trace:
File "downloadVideos.py", line 159, in <module> main() File "downloadVideos.py", line 136, in main video_file.write(f.read()) File "c:\python27\lib\socket.py", line 358, in read buf.write(data) MemoryError: out of memory
source share