c# - How to fix or get around a system out of memory exception when zipping large files? -


this question has answer here:

so have application zips directories , works except today got exception , when checked log turned out got system out of memory exception because of directory ~550mb. question is: there way around or enable application work bigger sized directories?

here code zips directories:

using (filestream ziptoopen = new filestream(destdir1, filemode.open)) {    using (ziparchive archive = new ziparchive(ziptoopen, ziparchivemode.update))     {       int ind = folder.lastindexof("\\") + 1;       string foldername = folder.substring(ind, folder.length - ind);        ziparchiveentry readmeentry;       directoryinfo d = new directoryinfo(folder);       fileinfo[] files = d.getfiles("*");       foreach (fileinfo file in files)       {         readmeentry = archive.createentryfromfile(folder + "\\" + file.name, foldername + "/" + file.name);       }       deletedirectory(folder);       } } 

it sounds limitation of ziparchive library, stores temporary data in memory when zipping.

it might not possible solve problem of excessive memory usage, work around issue rebuild application in 64 bit mode. remove memory ceiling you're experiencing.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -