Bug 18161 - ALAssetRepresentation Metadata
Summary: ALAssetRepresentation Metadata
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: master
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-03-04 13:07 UTC by manuel
Modified: 2014-03-11 12:56 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description manuel 2014-03-04 13:07:34 UTC
ALAssetRepresentation  Metadata field does not seem to be cleaned properly
For example, we have 2000 photos in our camera roll and if we access their meta information through this class and access this field without doing nothing with it, app starts receiving memory warnings and then it is killed by the OS
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-03-04 17:31:41 UTC
Could you please attach a test case we can use to reproduce this?
Comment 3 Rolf Bjarne Kvinge [MSFT] 2014-03-11 12:56:13 UTC
The issue is that internally iOS will add a lot of memory-heavy objects to an NSAutoreleasePool.

That pool is drained when asset enumeration completes, and that's when those objects are freed. There is nothing Xamarin.iOS can do about it, it's just how iOS works.

However you have (at least) two options:

* Add your own NSAutoreleasePool around the enumeration code. A simple implementation would be to change your code to do the following:

	using (var pool = new NSAutoreleasePool ()) {
		var metadata = asset.DefaultRepresentation.Metadata;

* Delay processing of the assets until enumeration is finished.