I have created a utility software for operating file copy process in python.Every thing is working nice but when i start copying any files larger than 2 Gb the the whole system hangs. It seems to me that it might be a memory leak issue.
I have tried:
- Copying it using Shutil Module
- Using Lazy operation by copying Chunks of Bytes
- Copying Files data LINE by LINE
- Using Fileinput Module
- Adjusting Buffer million times
- Writing copy file part with C and then Extending it with python.
…but none of this has worked.
Here are links to my File Script and my GUI Script:
I’m using Windows 7 with 2 Gb of RAM.
Can anyone help please?
Since you only have 2 GB of memory when you copy a file that’s larger than your memory, it causes issues. Don’t load the entire file into memory. Instead, I would do something like:
Since this can potentially take a long time, you should put this into a separate thread from your GUI or the GUI will appear to hang. Here are a couple links on that topic for wxPython: