iOS 8, latest JUCE
My App downloads a large set of files. Over 30 of them totalling 843 mb. Via a for loop, each file is downloaded, unzipped and saved to disk before moving onto the next file. But as it nears the end of the download, I start getting "Received Memory Warning" with each file, until it eventually crashes without finishing the download.
The MemoryBlock goes out of scope each time through the for loop, so I don't know why the memory allocation is persisting. I even tried calling reset() on the MemoryBlock. Here's my code (adapted from the Introjucer module download code):
for (//loop through files) { URL url(www.somepath.com); String destPath = //path in = url.createInputStream (false, nullptr, nullptr, String::empty, 10000); if (in) { MemoryBlock downloaded; in->readIntoMemoryBlock (downloaded); MemoryInputStream input (downloaded, false); ZipFile zip (input); File destFile = destPath; Result result = zip.uncompressTo (destFile, true); if (result.failed()) DBG ("Uncompress failed: " + result.getErrorMessage()); downloaded.reset(); // recently tried this, doesn't help deleteAndZero(in); } } }
Any ideas?