Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10480] iOS: Ti.Media.openMusicLibrary results in memory leak

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionHold
Resolution Date2012-08-20T12:09:33.000+0000
Affected Version/sRelease 2.1.0, Release 2.1.1
Fix Version/sRelease 3.0.0
ComponentsiOS
Labelsapi
ReporterNikhil Sharma
AssigneeNeeraj Gupta
Created2012-08-16T17:49:20.000+0000
Updated2017-03-17T18:30:39.000+0000

Description

Ti.Media.openMusicLibrary leaves 100k memory leak. You can see a set of objects related to search bar, UIImage remain allocated.

Repo Steps

1. Run the below code in app.js 2. Open the application in device. 3. Run the instruments and you can see the memory leak.
function showMusicLibrary() {
	Ti.Media.openMusicLibrary({
		success: function(picked) {
			Ti.API.info('picked: ' + picked.items[0]);
		},
		error: function(error) {
			var a = Ti.UI.createAlertDialog({
				title: 'Music Picker'
			});
	
			if(error.code === Ti.Media.NO_MUSIC_PLAYER) {
				a.setMessage('Please run this test on device');
			} else {
				a.setMessage('Unexpected error: ' + error.code);
			}
	
			a.show();
		},
		mediaTypes: [Ti.Media.MUSIC_MEDIA_TYPE_ALL],
		autohide: true
	});	
}

var tabGroup = Titanium.UI.createTabGroup();

var win1 = Titanium.UI.createWindow({  
    backgroundColor:'black'
});
var tab1 = Titanium.UI.createTab({  
    title:'Tab 1',
    window:win1
});

var button = Titanium.UI.createButton({
	title: 'Select music',
	width: 200, height: 40
});

win1.add(button);

button.addEventListener('click', function() {
	showMusicLibrary();
});

tabGroup.addTab(tab1);  
tabGroup.open();

Comments

  1. Nikhil Sharma 2012-08-20

    This ia an apple bug. Problem ID: 12133443 Since it's an iOS SDK issue so putting it on hold. Waiting for apple to fix it.
  2. Eric Merriman 2013-01-10

    Nikhil, could you check on the status of any fix from Apple please?
  3. Lee Morris 2017-03-17

    Closing ticket due to time passed.

JSON Source