Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17580] Android : Memory was Increased Reading file from SDCard

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.3.0
Fix Version/sn/a
ComponentsAndroid
LabelsSDCard, TCSupport, android
ReporterSattanathan
AssigneeUnknown
Created2014-07-31T08:49:16.000+0000
Updated2018-02-28T20:03:56.000+0000

Description

Problem Description

In my app we used icons and images. All the file size less than 20Kb. All this files are Download from server and store to SDCard. When we getting file from SDCard HEAP memory was increased and some time app will be EXIT. we put the same file inside the RESOURCE folder after we tried Heap Memory was not increased and app was stabled. Please refer the screenshot. Hello, We have tested the issue with the following code below and we have observed the same problem.

TESTING ENVIRONMENT

CLI version 3.3.0, Titanium SDK version 3.3.0.GA Android Device

STEP TO TEST

- Create a new Project - Copy the Code above to the project "app.js" file
var win = Titanium.UI.createWindow({
     backgroundColor : 'white',
    top : 0,
    left : 0,
    width : '100%',
    height : '100%',
    title: "Base Window",
    layout:'vertical'
});
 
var receiptDir=Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory,'TempFile');
if (! receiptDir.exists()) {
   receiptDir.createDirectory();
}
var receiptFile = Titanium.Filesystem.getFile(receiptDir.resolve(),'Untitled.rtf');
  
var read = Ti.UI.createButton({
     title : 'Read From File',
});
 
read.addEventListener('click', function() {
     alert(receiptFile.read().text);
});
 
win.add(read);
 
win.open();
- Substitute the file name "Untitled.rtf" with the file's name that you want to read from SDCard, in your "app.js" file. (Untitled.rtf is here attached) - Run the app - Click "Read From File" to read your file, which will show in alert.

Actual results

The console shows
[INFO] :   I/dalvikvm-heap: Grow heap (frag case) to 10.670MB for 1536080-byte allocation 
which indicates that the heap memory has raised.

Extra information

tiapp.xml
<property name="ti.android.threadstacksize" type="int">41943040</property>
<property name="ti.android.httpclient.maxbuffersize" type="int">41943040</property>
<tool-api-level>17</tool-api-level>
        <manifest android:installLocation="preferExternal">
            <uses-sdk android:minSdkVersion="15"/>
            <supports-screens android:anyDensity="true"
                android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
        </manifest>

Attachments

FileDateSize
Screen Shot 2014-07-31 at 4.09.35 pm.png2014-07-31T08:49:16.000+0000101058
Untitled.rtf2014-08-16T04:48:56.000+0000398

Comments

  1. Mauro Parra-Miranda 2014-08-01

    Hello! Please provide a testcase in the form of app.js with a sample image produced in the same way (size, colors, etc). Best Regards!

JSON Source