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>
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!