The current version of the plugin for Windows uses an unzip technique that requires copying each entire file in the zip archive into memory, before writing the file to disk. This works fine on small files, but causes the application to crash with an Out of Memory exception on larger files.
Since all the Windows file reading and writing uses streams, the change in this pull request removes the unnecessary reading of the file stream into a memory buffer and instead directly pipes the zip entry file to the output stream using CopyToAsync letting Windows handle the copy. This also has the benefit of being asynchronous, removes the memory loading step, and is simpler code overall.
I've successfully copied gigabyte files with almost no memory impact. I've tested this under Windows 10 only, however MSDN listsCopyToAsync as being available since Windows Phone 8.1 and Universal Windows Platform 8.
The current version of the plugin for Windows uses an unzip technique that requires copying each entire file in the zip archive into memory, before writing the file to disk. This works fine on small files, but causes the application to crash with an
Out of Memory
exception on larger files.Since all the Windows file reading and writing uses streams, the change in this pull request removes the unnecessary reading of the file stream into a memory buffer and instead directly pipes the zip entry file to the output stream using
CopyToAsync
letting Windows handle the copy. This also has the benefit of being asynchronous, removes the memory loading step, and is simpler code overall.I've successfully copied gigabyte files with almost no memory impact. I've tested this under Windows 10 only, however MSDN lists
CopyToAsync
as being available since Windows Phone 8.1 and Universal Windows Platform 8.