Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1820] Android: Possible mem issue when loading remote images

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-01-05T22:28:34.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid, core
ReporterThomas Froesig
AssigneeShak Hossain
Created2013-05-13T16:36:02.000+0000
Updated2016-03-08T07:40:43.000+0000

Description

When trying to loade remote images into the backgroundImage property of a View, the app crashes hard. See attached log. I have attached the js files which causes the crash, and a sample gif. (no remotelink's or other resources though). Please note the remote pictures loaded are only 4-7 kilobytes each, and the app crashes when loading more then 4.

Attachments

FileDateSize
littleBeltContainer.js2013-05-13T16:36:02.000+000012693
log.txt2013-05-13T16:36:02.000+00005969
sample.gif2013-05-13T16:36:02.000+00002052

Comments

  1. Carter Lathrop 2013-05-15

    Thomas, I went through the code provided and I could not see a backgroundImage for a view loaded from a remote location. A remotely located backgroundImage is when an image is specified by a URL. Here is an example of using a remote image as a backgroundImage for a view:
       Ti.UI.backgroundColor = 'white';
       var win = Ti.UI.createWindow();
       var image = Ti.UI.createView({
         backgroundImage:'http://rack.2.mshcdn.com/media/ZgkyMDEyLzEyLzAzL2U0L3NlZWhvd3lvdXJnLjlyMS5qcGcKcAl0aHVtYgk5NTB4NTM0IwplCWpwZw/8fec6ce4/e71/see-how-your-google-results-measure-up-with-google-grader-video--6b8bbb4b41.jpg'
       });
       win.add(image);
       win.open();
       
    This is working as expected. Also, the code provided is a bit long to be considered as a test case for an issue, generally test cases are under 100 lines of code but it is encouraged to keep them below 50 lines if possible. This way the issue can be isolated due to removing extra factors. Would you mind reducing your test case as such? For future reference: https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report Regards, Carter
  2. Thomas Froesig 2013-05-17

    Hi there Carter, I see your point that the code is too long. The images are required from another .js file - and then updated as background in the views. I'll try and reproduce in smaller and more compact example. Best Wishes /Thomas
  3. Shak Hossain 2013-12-09

    Hi Thomas, We have not heard back from you since your last update in May. Not sure if this is still showing memory issues in your app. If so, please send us a test case so that we can take next necessary step to fix. If we don't hear back, we will assume the issue is no longer valid and close it.
  4. Mostafizur Rahman 2013-12-30

    Hello, We tested this issue with the test code below. We can’t reproduce this issue. It’s working as expected.

    Test Environment:

    MAC OS X 10.8.5 Ti SDK 3.2.0.GA Ti CLI 3.2.0 Android 2.3.3, 4.2.2

    Test Code

    app.js
       var win = Ti.UI.createWindow({
       		title : ' Remote Image',
       		navBarHidden : false,
       		layout : 'vertical'
        
       	});
       	
       // Import module	
        
       var photoDisplay = require('test');
       var photoView = new photoDisplay();
        
       /*
        * Create different view
        */
        
       var view1 = Ti.UI.createView({ 
       	backgroundColor:'pink' ,
       	width:'auto',
       	height:'auto'
       	
       });
         
        
       view1.add(photoView);
       win.add(view1);
        win.open();
       
    test.js
       
       function test()
       {
       	// create view
       	 var viewContainer = Ti.UI.createView({ 
       		backgroundColor:'pink' ,
       		width:'auto',
       		height:'auto',
       		layout:'vertical'
       		
       	});
       	
       		// create imageviews
        
       	var imageView1 = Ti.UI.createView({
           backgroundImage: 'http://rack.2.mshcdn.com/media/ZgkyMDEyLzEyLzAzL2U0L3NlZWhvd3lvdXJnLjlyMS5qcGcKcAl0aHVtYgk5NTB4NTM0IwplCWpwZw/8fec6ce4/e71/see-how-your-google-results-measure-up-with-google-grader-video--6b8bbb4b41.jpg',
           width:'70',
           height:'70',
           top:75
          
           
          });
          var imageView2 = Ti.UI.createView({
           backgroundImage: 'https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-prn2/q71/s720x720/1464712_555903507835512_1935095682_n.jpg',
           width:'70',
           height:'70'
          
           
          });
          var imageView3 = Ti.UI.createView({
           backgroundImage: 'http://rack.2.mshcdn.com/media/ZgkyMDEyLzEyLzAzL2U0L3NlZWhvd3lvdXJnLjlyMS5qcGcKcAl0aHVtYgk5NTB4NTM0IwplCWpwZw/8fec6ce4/e71/see-how-your-google-results-measure-up-with-google-grader-video--6b8bbb4b41.jpg',
           width:'70',
           height:'70'
          
           
          });
          var imageView4 = Ti.UI.createView({
           backgroundImage: 'https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-prn2/q71/s720x720/1464712_555903507835512_1935095682_n.jpg',
           width:'70',
           height:'70'
          
           
          });
          var imageView5 = Ti.UI.createView({
           backgroundImage: 'http://rack.2.mshcdn.com/media/ZgkyMDEyLzEyLzAzL2U0L3NlZWhvd3lvdXJnLjlyMS5qcGcKcAl0aHVtYgk5NTB4NTM0IwplCWpwZw/8fec6ce4/e71/see-how-your-google-results-measure-up-with-google-grader-video--6b8bbb4b41.jpg',
           width:'70',
           height:'70'
          
           
          });
          
          // Add to parent
        
           viewContainer.add(imageView1);
           viewContainer.add(imageView2);
           viewContainer.add(imageView3);
           viewContainer.add(imageView4);
           viewContainer.add(imageView5);
       	return viewContainer;
       	
       };
        module.exports = test;
       
       
    Thanks
  5. Shak Hossain 2013-12-31

    Closing it since we have not heard back from the reporter. A functional code sample has been posted for reference.

JSON Source