Skip to content

Out of memory error #87

@Whip

Description

@Whip

Which platform(s) does your issue occur on?

  • Android
  • 7.1.1 Nougat
  • Mobile device

Please, provide the following version numbers that your issue occurs with:

  • CLI: 4.1.2
  • Cross-platform modules: 4.1.1
  • Runtime(s): android - 4.1.3
  • Plugin(s):
"dependencies": {
    "nativescript-cardview": "3.1.1",
    "nativescript-fresco": "4.0.0",
    "nativescript-loading-indicator": "2.4.0",
    "nativescript-material-icons": "1.0.3",
    "nativescript-plugin-firebase": "6.4.1",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-toast": "1.4.6",
    "nativescript-ui-dataform": "3.6.1",
    "nativescript-ui-listview": "3.5.11",
    "nativescript-ui-sidedrawer": "4.2.1",
    "tns-core-modules": "4.1.1"
  },
  "devDependencies": {
    "babel-traverse": "6.4.5",
    "babel-types": "6.4.5",
    "babylon": "6.4.5",
    "lazy": "1.0.11",
    "nativescript-dev-webpack": "~0.14.0"
  }

Please, tell us how to recreate the issue in as much detail as possible.

Create a page and load a bunch of images in a list view. That's all I've done so far.

Is there any code involved?

In app.js

var fresco = require("nativescript-fresco");
if (application.android) {
  application.on(application.launchEvent, function(args) {
  	console.log("initialized");
        fresco.initialize();
  });
}

In xml

<Page navigatingTo="onNavigatingTo" xmlns="http://schemas.nativescript.org/tns.xsd"
	xmlns:sd="nativescript-ui-sidedrawer"
	xmlns:customControls="shared"
	xmlns:Card="nativescript-cardview"
	xmlns:lv="nativescript-ui-listview"
	xmlns:nativescript-fresco="nativescript-fresco">
        <ScrollView orientation="horizontal" id="silverNew">
		<StackLayout orientation="horizontal" class="new-arrivals">
			<lv:RadListView items="{{ silverItems }}" >
				<lv:RadListView.listViewLayout>
                		        <lv:ListViewLinearLayout scrollDirection="Horizontal"/>
            			</lv:RadListView.listViewLayout>
				<lv:RadListView.itemTemplate>
		                          <Card:CardView class="cardStyle" elevation="15" radius="10" ripple="true" width="120">
						    <grid-layout rows="120, auto">
					                    <nativescript-fresco:FrescoDrawee row="0" width="120" height="120" imageUri="{{ image }}" placeholderImageUri="~/images/loading.jpg" failureImageUri="~/images/loading.jpg" progressiveRenderingEnabled="true" />
					                    <StackLayout row="1" class="card-content">
						                    <label text="{{ name }}" class="bold" />
						                    <Label text="{{ weight }}" />
							    </StackLayout>
						   </grid-layout>
					</Card:CardView>
				</lv:RadListView.itemTemplate>
			</lv:RadListView>
		</StackLayout>
	</ScrollView>
</Page>

For now, I'm returning the same image for every view which is about 85KB in size and there are 20 of them. I get the error

System.err: Caused by: java.lang.OutOfMemoryError: Failed to allocate a 4665612 byte allocation with 4433024 free bytes and 4MB until OOM
System.err: 	at dalvik.system.VMRuntime.newNonMovableArray(Native Method)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions