Am using 3.1.3.GA sdk, Alloys and 2.3.3 Android Emulator and also tested with Sony Xperia J(Android 4.1.2). I am loading images from my server, crops and resize it and place it in TableViewRow. Always in info its saying as Jit: resizing JitTable from xxx to yyy and finally Bitmap vm budget exceeds and stops loading and app crashes. I have to removed all the views used in window to null. Even this error fires. I have seen many problems in QA like this and nothing have solution as per my search. Please help me get rid of this, My Sample Code
searchResults.xml
<Alloy> <Window id="searchResults" navBarHidden="true"> <View id="containerView"> <View id="mainView"> <Require src="headerWithBack" id="headerWithBack"></Require> <TableView id="searchResultContainer" onClick="openDetails" onScroll="lazyLoad"> <FooterView> <View id="footerView"> <ActivityIndicator id="loader"/> <Label id="loadingIndicator" visible="false">No more datas to load.</Label> </View> </FooterView> </TableView> <Require src="WindowFooter" id="WindowFooter"></Require> </View> <View id="slidingView"> <Require src="slidingMenu" id="slidingMenu"></Require> </View> </View> </Window> </Alloy>index.js
function loadResults(){ var url = 'XXX'; var actionMethod = 'GET'; var successFunction = function(response, xhrObject){ if(!ajaxCancel && response.success){ var results = response.results; for(var i=0,j=results.length;i<j;i++){ var cabImageURL = vehicleList[i].resourceURL === '' ? 'someURL' : 'someURL'; var cabImage = imageManipulation(cabImageURL); data.push(Alloy.createController('views/test', { cabImage: cabImage, }).getView()); } searchResultContainer.appendRow(data); }else{ if(!ajaxCancel){ var message = Alloy.Globals.someErrors; Alloy.Globals.createToastNotification(message); } } }; var errorFunction = function(error){ //alert(error); Ti.API.info(error); var message = Alloy.Globals.someErrors; Alloy.Globals.createToastNotification(message); }; cabyAjaxUtils.getAjax(url, {}, actionMethod, successFunction, errorFunction); } function imageManipulation(imageURL){ var newImage; var originalImage = Ti.UI.createImageView({ image : imageURL, width : 'auto', height : 'auto' }); var imgBlob = originalImage.toBlob(); var height = imgBlob.height; var width = imgBlob.width; if (height > width) { var pos = (height - width) / 2; var dict = { height : width, width : width, x : 0, y : pos }; newImage = imgBlob.imageAsCropped(dict); newImage = newImage.imageAsResized(width, height); }else if (height < width) { var pos = (width - height) / 2; var dict = { height : height, width : height, x : pos, y : 0 }; newImage = imgBlob.imageAsCropped(dict); newImage = newImage.imageAsResized(width, height); }else { newImage = originalImage; } originalImage = null; imgBlob = null; return newImage; } $.searchResults.open();test.xml
<Alloy> <TableViewRow className="results"> <View id="container"> <ImageView id="cabImage"/> </View> </TableViewRow> </Alloy>I have posted a sample code of my application. The major place where am getting error is ImageView, even I tried posting images without using imageManipulation() too and I dont think error in that function. I released all of the objects and events I created when close that window. May be images loaded from server are cached and not released or else what may be problem. How to release memory allocated to those images. Thank you.