Hello Guys,

My quest for leaks continues... I'm downloading files from our server, and
the size of the files can vary between 1 and 20 MB.
The issue is that after the file is downloaded, the app's dirty size goes
up ~20MB and never goes down even if I dispose the WebClient, remove all
event listeners and call GC.Collect().
If I run the download code a few times, it climbs 20 MB about 3x, then it
stops even if I call it again. Is there some kind of cache that is being
maintained or something? How can I make sure some of that memory is
reclaimed. We're tight on memory on the iPod Touch and we'd love to get
some of it back :)

Here's the code that I'm running:

void DoStuff()
{
WebClient client = new WebClient();
client.DownloadProgressChanged += client_DownloadProgressChanged;
client.DownloadDataCompleted += client_DownloadDataCompleted;
client.DownloadDataAsync(new Uri("
http://ipv4.download.thinkbroadband.com/20MB.zip";));
}

 void client_DownloadDataCompleted(object sender,
DownloadDataCompletedEventArgs e)
{
var webClient = sender as WebClient;
webClient.DownloadDataCompleted -= client_DownloadDataCompleted;
webClient.DownloadProgressChanged -= client_DownloadProgressChanged;
webClient.Dispose();
webClient = null;
GC.Collect();
GC.WaitForPendingFinalizers();
MessageBox.Show("Completed");
}

--
Matt
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to