0

When I open this activity the memory allocated goes from 11MB to almost 50MB..

In this activity I've only a framelayout with Images.. And I move the dot image with the onTouchEvent..

Can Anyone tell me why I'm using such a lot memory? Even when I press the back button leaving the activity the memory allocated remains 50MB

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/fl"
    tools:context="it.uniroma3.sensorlog">

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@mipmap/mappa"
    android:id="@+id/map"/>

<ImageView
    android:layout_width="10dp"
    android:layout_height="10dp"
    android:src="@android:drawable/ic_notification_overlay"
    android:id="@+id/dot"
    />

</FrameLayout>

2 Answers2

2

The point is: we can't know.

Thing is: this memory is somehow consumed by your application. Which only you are able to run and profile.

Thus, the essential answer here is: learn how to use the corresponding tools; and go figure yourself.

Good starting points would be here, or that other existingquestion on that subject.

Given your comment; and the other answer: a first, direct experiment could be: go for a very small set of small images; and see if that makes a difference. If it does; you know where to search.

Community
  • 1
  • 1
GhostCat
  • 137,827
  • 25
  • 176
  • 248
  • I know, but it's a really simple application.. two activities: 1) in the first one there's only a textview 2) in the second one there are only these two imageviews.. the map view is full screen and the second one is just a dot image –  Apr 25 '17 at 08:48
  • 1
    Why does this have a downvote? It's true, we can't know why your application consumes a lot of memory by looking at ONE xml file. – Denny Apr 25 '17 at 08:53
0

I had the same issue, the problem is most probably with your image resolution, try reducing it.