rahstame
rahstame

Reputation: 2178

Memory Leak on one instance of a View

I got a memory leak on ColumnListView, I will show below the leak suspect. It occupies 2,720,840 (18.65%) bytes of the allocated memory.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {


    gView = inflater.inflate(R.layout.ac_image_grid, container, false);


    multi = new WeakReference<ColumnListView> ((ColumnListView) (finalView.findViewById(R.id.list)));

One instance of "com.lib.ColumnListView" loaded by "dalvik.system.PathClassLoader @ 0x4123aa30" occupies 2,720,840 (18.65%) bytes. The memory is accumulated in one instance of "byte[]" loaded by "<system class loader>".

Keywords
dalvik.system.PathClassLoader @ 0x4123aa30
com.lib.ColumnListView
byte[]

XML

<?xml version="1.0" encoding="utf-8"?>
    <com.lib.ColumnListView 
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:pla="http://schemas.android.com/apk/res-auto"
        android:id="@+id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        pla:plaColumnNumber="2"
        pla:plaLandscapeColumnNumber="3"
        >
    </comlib.ColumnListView>

Upvotes: 0

Views: 258

Answers (1)

Turix
Turix

Reputation: 4490

This is just a guess, but your casting syntax looks odd to me, and this may be causing the problems too. Instead, try:

multi = new WeakReference<ColumnListView> ((ColumnListView)finalView.findViewById(R.id.list));

Upvotes: 1

Related Questions