Consuming a lot of memory

Topics: Developer Forum
Jul 2, 2012 at 12:49 PM
Edited Jul 2, 2012 at 12:51 PM

with this simple console application test

string response = string.Empty;

Flickr flickr = new Flickr("84753984759348759348759");
PhotoSearchOptions searchOptions = new PhotoSearchOptions();
PhotoCollection photos = new PhotoCollection();

while (response != ".")
	Console.Write("Search: ");
	string search_term = Console.ReadLine();
	Console.Write("perpage: ");
	string perpage = Console.ReadLine();

	searchOptions.Tags = search_term.Trim();
	searchOptions.PerPage = Convert.ToInt32(perpage);
	searchOptions.SortOrder = PhotoSearchSortOrder.Relevance;

	Console.WriteLine("starting to search for '" + search_term + "' ...");
	photos = flickr.PhotosSearch(searchOptions);

	Console.WriteLine("found: " + photos.Count);

	Console.WriteLine("press '.' to quit");
	response = Console.ReadLine();

Console.WriteLine("test done");

running the test gives the application an initial memory working set of 3120kb or sometimes 5k+ kb

will search "cats" and 10 per page gives app test a staggering 88k+ KB

on the same loop.. I looked for "dogs" and 20 per page, raise to 90k+ KB

then I looked for "nature" and 200 per page, stays at 90k+ or sometimes 92k+ KB

can the memory consumption be optimized?


check the preview here

Jul 2, 2012 at 1:08 PM

I just tried that very code on my machine, and it didn't go above 7.5k KB, so not sure what the issue might be at your end.


Jul 2, 2012 at 1:47 PM
Edited Jul 2, 2012 at 1:49 PM

wow .. magical! 

I ran the test app like several times and my project like the whole month on 3 different pcs and the memory just increases like the one I reported

now that I reported it. It stopped .. I tried searching .. and it won't even go up to 5k+ kb

did you do something? :)

Jul 2, 2012 at 1:50 PM

anyway, I just thought disabling the Cache helped ...