Note that there are some explanatory texts on larger screens.

plurals
  1. POdialog box memory leak or stubborn GC?
    primarykey
    data
    text
    <p>When I load up my app, It takes around 3Mb of RAM. I have an <code>ImageButton</code> on my first activity which calls the function <code>showRecords</code>, which displays a dialog box.</p> <p>Once the dialog box is opened, it can be closed by clicking outside of the box (which will call the <code>dismiss()</code> method). The problem I am having is that after the dialog box has been closed, the amount of RAM used by my application does not return to its previous state (it can remain over a Mb more If I include another stuff in the dialog - but the example retains around 2-300kb)</p> <pre><code> public void showRecords(View v){ Dialog recordDialog = new Dialog(this); recordDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); recordDialog.setCanceledOnTouchOutside(true); recordDialog.setContentView(R.layout.record); recordDialog.show(); } </code></pre> <p>The record.xml file has an image background, and another ImageView with a picture.</p> <p>I have tried using MAT, and can see no Dialog objects in memory. I also have been using DDMS to perform garbage collections, but the RAM value never returns to what I would expect.</p> <p>Is something binding to the activity? or is the GC just refusing the reclaim the memory?</p> <p>As this is my first activity, it remains alive throughout and doesn't seem to close if I need more heap space (for some reason). Therefore I'm quite interested in reclaiming a Mb of memory when it is not needed.</p> <p>EDIT - record.xml</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/background" android:orientation="vertical" &gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/recordspage" android:layout_marginTop="5dp" android:layout_gravity="center_horizontal" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" /&gt; &lt;/LinearLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload