Android :: Leads To Theorize That Memory Is Leaking On The Stack

May 7, 2010

I'm writing an app that has a foreground service, content provider, and a Activity front end that binds to the service and gets back a List of objects using AIDL. The service does work and updates a database.

If I leave the activity open for 4-8+ hours, and go to the "Running Services" section under settings on the phone (Nexus One) an unusually large amount of memory being used is shown (~42MB).

I figure there is a leak. When I check the heap memory i get Heap size:~18MB, ~2MB allocated, ~16MB free. Analyzing the hprof in Eclipse MAT seems fine, which leads me to theorize that memory is leaking on the stack. Is this even possible? If it is, what can I do to stop or investigate the leak? Is the reported memory usage on the "Running Services" section of android even correct (I assume it is)?

Another note: I have been unable to reproduce this issue when the UI is not up (with only the service running)

Android :: leads to theorize that memory is leaking on the stack


Android :: ClassLoader Leaking Memory?

Dec 17, 2009

I have a ClassLoader in Activity's onCreate which loads a specific class from a library, and is working fine, except that when activity is destroyed, the memory resources about the loaded class are not released.If the same activity gets created multiple times very quickly (by launching it, and destroying it by pressing the Back button), and the process doesn't happen to be killed by Android yet, the memory usage of the corresponding process grows continuously until the app crashes,and process dies.The problem is that this happens even if no objects are instantiated using the loaded class. There seems a problem with garbage collector, which doesn't seem to release resources about the loaded class on Destroy even if there are no references to it.If android would have killed the process right away when the last activity of the process gets finished, there wouldn't be a problem, but this is managed by Android system, and it doesn't always kill the process right away. A workaround may be to kill the process explicitly on destroy, but this is not encouraged way to do, as Android is supposed to manage the process.

An alternative is to have a functionality that allows a class to be unloaded onDestroy, but this doesn't exist. By design, the garbage collector is supposed to take care of this.Is there a solution regarding this?

View 8 Replies View Related

Android : ActivityThread.ContextCleanupI­nfo Leaking Memory

Dec 16, 2009

I'm trying to locate a memory leak in my app (it's client for a mediacenter). So I start it up, go to the screen that lists all movies, go back to my home activity, trigger the GC a few times manually via DDMS, dump the memory heap, pull it, convert it and load it into MIT in Eclipse.

Now the movie list screen is pretty heavy, around 800k of movie objects, which should be freed when I go back to the home screen. However, it stays allocated, with the GC root as a local variable in the main thread at ActivityThread.ContextCleanupInfo (see attached screenshot).

I've tried searching but there is no documentation on this class, not even in the source code. Is there any way to avoid this kind of behavior? Am I doing something wrong or is the problem in Android? My app is open source and can be checked out here[1]. http://code.google.com/p/android-xbmcremote/

View 4 Replies View Related

Android : Debugging Memory Leaking - Program

Mar 31, 2009

What would be the best way to debug a leaking program?

I have developed a media player (includes a background service doing the playing, and a UI, and I access getResources(), MediaStore and things like this often).

Whenever I rotate the screen or reenter the app the total memory allocated to my process grows some 70 to 100KB. After some 6-10 rotations it is dead due to an out of memory exception.

In the meantime I have removed every static modifier to global vars, added an onDestroy function that unregisters the intents and service connection (and even puts every global var to null again :P), but still the program memory grows... and dies after a few rotations.

Given the situation I even made the program stop right after just calling setContentView, and still the memory leaks:

CODE:......................

View 3 Replies View Related

Android : Activity Lifecycle Cause Memory Leaking

Aug 7, 2009

http://developer.android.com/reference/android/app/Activity.html

The Activity Lifecycle could have implementation and or design bug: One case is to initialize a big image in onCreate(), try to reuse the image during the whole lifecycle, and then recycle the image in onDestroy(). Test showed that onCreate() is called every time one navigate away from the activity and back again, but onDestroy() is not called at all. This behavour causes memory leaking for the big image (size 960*1920). After 6+ times away and back to activity, the system runs out of memory and has to kill the process.

One workaround is to initialize the big image in onResume() and recycle in onPause(), but that's not so good reuse.

Could it be better to change the process (as shown in the diagram) a little bit such as: Call onDestroy() first when a process is killed?

View 3 Replies View Related

Android : Simple ListView App Is Leaking Memory

Nov 18, 2010

I created a simple app with a ListView following the ListActivity examples I found on the net.

The app has 2 activities with the first having a button to create the second. When i hit the close button on the second activity I would like it to release its memory (or at least allow it to be garbage collected).

Currently it will never release.

I must be doing something wrong here because the MyListActivity never gets released. Can anyone tell me if I am doing something wrong with the way my activities are created/destroyed? or if my usage of the ListView is wrong?

My App as a zip - http://www.mediafire.com/?l26o5hz2bmbwk6j

Screen Shot of Eclipse MAT showing the list activity never releasing memory - www.mediafire.com/?qr6ga0k

View 1 Replies View Related

Android :: Find Exact Place Of Memory Leaking?

Oct 23, 2009

can anyone tell me any solution or tool provided by Android to find the exact place of memory leaking?

View 2 Replies View Related

Android :: Way To Visualize Activity Stack (activities In Memory) On Droid?

Jun 26, 2010

I'm currently debugging my app which is quite complex and has up to 5 activity levels. In order to detect memory leaks (i.e. activities that aren't removed from memory even finish() is called, due to some references held somewhere) I want to check which activities are still alive in memory. Currently I create hprof dumps, but it's not very convenient, cause every time I need to mount the sdcard, copy the hprof dump file from the sdcard to my PC, etc. (Side note: I already tried to automate the pulling of my hprof file more easily, but I'm on an unrooted device and adb pull <hprof file> won't let me / no permission.) Therefore I am wondering, if all I want to know is IF and WHICH activities are still currently alive in my memory, is there a way through the Android API or any other way on-the-fly with which I can achieve this (list all alive activities of my app), programatically.

View 2 Replies View Related

Android :: "Out Of Memory" / No Useful Stack Trace

Apr 11, 2010

My android app is getting an "Out of memory" error without a useful stack trace. It occurs after I have repeatedly re-invoked its main logic through a menu interaction, which leads me to believe that there's a memory leak somewhere.

I say that the stack trace isn't useful because it doesn't include references to any of my own code. There are no references to my own code in the logcat output, either.

I'm wondering if any of you can help me figure out where my memory leak might be occurring, given my stack trace and my logcat output.

Here's the stack trace: Code...

Could my error be related to the "Window already focused ..." warnings? If so, how can I find out what is causing these? I know that I could sprinkle my code with lots of calls to Log.v() in order to zero in on where my problem might be occurring, but I'm wondering if there is a better way to get more meaningful information about the cause of my memory leak.

View 5 Replies View Related

Android :: Unserializing Objects Via The Hessian Web Protocol Leads To ClassNotFoundException

Aug 24, 2010

I am using the Hessian web protocol[1] or rather more the Android port Hessdroid[2] to fetch and unserialize objects from a web server. It works quite well but unfortunately I get this message:

CODE:......

When actually unserializing an object. The code within the library that throws the warning is:

CODE:.......

I guess the problem is that the class NewsSetCategory resides in a package and so cannot be loaded without the whole package name by the ClassLoader but this is a bling guess.

Is there a way to adapt the class path or to easily create a new PathClassLoader that will load classes directly from the package? Or does anybody else have any experience with Hessian on Android?

View 8 Replies View Related

HTC EVO 4G :: Flashing Kernels Leads To Constant Boot Loop

Sep 19, 2010

Every time I flash a different Kernel my Evo goes into a boot loop. I am using RA-Recovery, and wiping Data/cahe and dalvik before flashing. I flashed a new ROM and was able to install Kernel one time, any more than that and the Boot loop starts, even if i flash the first kernel that did work it still loops on me. I was on Clockwork and changed over to RA, that did not help, tried both BFS and CFS and no change. Tried Kingx 8 and 9, netarchys 4.18 and 4.19. I flashed 3.28.651.1 then netarchy's 4.1.9 and it started the BL, then reflashed 3.28 and tried kingx 9 and it worked, I'm beginning to wonder if there is something with netarchy's kernels that my Evo doesnt care for? I should add that this time when wiping i only wiped cache and dalvik and left the data alone. I suppose the only real way to find the culprit is to test out all the variables.

View 7 Replies View Related

Samsung Vibrant :: Messaging App Leads To Random Apps / Fix It?

Sep 27, 2010

Sometimes when I launch the "Messaging" application, it randomly opens a random app that I have been currently using.

Sometimes it works and just shows all of my messages. This is quite annoying and this has happened to me even after several factory resets.

Am I the only one with this issue? I have searched the forum but couldn't find a related thread.

View 3 Replies View Related

Sprint HTC Hero :: MMS Messaging Trouble Leads To Hope For Upgrade

Mar 22, 2010

Well I was trying to get sprint to understand my frustration over a lack of MMS messaging for my Hero, and the call got disconnected. While I spoke with another rep, I got a voice mail. With some info I desperatly hope is true.

View 8 Replies View Related

Android : Leaking Bitmaps From Adapter's GetView

Mar 31, 2009

I definitely have a memory leak problem and i'm trying to figure out there. After 6-10 config changes i'm getting out of memory in regards to BitmapFactory. I'm kind of suspect that this is going on within adapter. I have a listview . ListItems are an thumbnail image ( ImageView ) and TextView for text.

Here is the getView code.

CODE:..................

And get ThumbnailBitmap() is basically BitmapFactory.decodeByteArray ..

Is it possible that i'm leaking drawables ? Heap is not increasing by the way .

View 3 Replies View Related

Android : Avoid Leaking Context In ArrayAdapter

Sep 28, 2010

I read the Avoiding Memory Leaks article with interest, and am concerned about danging references to the context object. I have a class like the following.

CODE:.........

Is it a problem to have a reference to a LayoutInflater object, since it must be using the context object somehow? Is there a better design pattern for what I'm trying to do here? (Use the context only to initially inflate the XML; from then on just use the View that's passed in to getView)

View 1 Replies View Related

HTC Droid Eris : Leaking Revisions On Purpose

May 5, 2010

Anybody else thinking that the revs are being leaked deliberatly and they are using us to test them and find the bugs?

View 22 Replies View Related

HTC EVO 4G :: Fixed Light Leaking And Screen Separation With Glue

Jul 7, 2010

I finally decided to do it. I had an idea to use the corner of a sheet of paper dabbed in krazy glue to slide up and down the sides and bottom of my phone while holding the screen down for a while. Surprised, it worked like a champ, and any excess glue that got anywhere on the phone was easily removed with acetone. Unless you have very sturdy hands, I would not advise this.

View 5 Replies View Related

Motorola Droid : Light Leaking Bottom Buttons

Nov 19, 2009

The bottom four buttons on my droid leak light if I look at it certain angle...

View 5 Replies View Related

Motorola Droid :: Tilt Phone Down / Light Leaking Up To Edge Of Screen

Nov 13, 2009

I just picked up a Droid today, and I just seen, above the 4 touch buttons when they are lit up, if you tilt the phone down you can see light leaking up to the edge of the screen. Does anyone else have this problem or should I return my device?

View 36 Replies View Related

Android :: Stack Of Activity From Activity Stack

Nov 2, 2009

There is a stack of activity i want to call the activity from that stack , My question is that is it possible to check from that stack and call that intent.When i press home button and again when i press the executable it should start the activity where i have left .Is it possible?Any example related to the same would be great help

View 3 Replies View Related

Android :: Installer Intent To Install On Memory Card Or On Phone Memory

Dec 2, 2009

How to tell the installer intent to install on memory card or on phone memory ?

View 2 Replies View Related

Android :: Out Of Memory / Orientation Change / Memory Analyzer Question

Jan 21, 2010

My application is designed to support both portrait and landscape orientations. Using my HTC IO device, it survives 12 orientation changes before throwing an out of memory exception while inflating my activity.When I follow the recommended procedure of using DDMS to first force a GC and then write a heap dump, and then load it into the Eclipse Memory Analyzer, there is only one retained instance of my application, as there should be. None of the other retained objects are obvious offenders. Just for yuks, I reran the test, and did everything the same way except I didn't force a GC. In this case I see 13 instances of my application, which is more consistent with throwing an OOM exception. Is this telling me something useful? If forcing a GC with DDMS reclaims the memory used by now-defunct instances of my activity, I would have thought the VM would have garbage collected some, if not all of these defunct activities automatically. Do I need to request GC at the very beginning of my activity lifecycle to make sure?

View 7 Replies View Related

Android :: Stack Based JVM

Dec 21, 2009

can any one tell me what is d actual diff in Stack based and Register based JVM?

View 2 Replies View Related

Android :: SIP Protocol Stack

Oct 12, 2010

How can i implement SIP protocol in android.I want to make video conferencing application using SIP protocol.So is it feasible using SIP protocol and how to start.

View 1 Replies View Related

Android :: Is There Any Stack For RTP / New SDK Support This?

Dec 1, 2009

Hello all, I am new in android developer and I would like to make a sip based application for this platform. In the signaling part I have found about jain-sip (used it) and sipdroid( any good tutorial? ) the problem starts when I want to stream data from a phone to a server. So the question is: Is there any stack for RTP? does the new SDK support this? I have found this: http://www.hsc.com/tabid/87/ItemId/20/Default.aspx have anyone used this stack? also I found this video on youtube :http://www.youtube.com/watch?v=g1NHEsXFEns which demonstrates the use of rtp to stream video/audio is this fake does any one know how? also I have read somewhere on the net that sipdroid has support for rtp is this correct? thanks in advanced and sorry for the long list of questions regards maxsap

View 4 Replies View Related

Android :: Bluetooth Stack Becomes Unresponsive

Apr 13, 2010

After Bluetooth connection is lost. Bluetooth stack on HTC Legend is messed up. Nothing works till Bluetooth is turned off and on. Here is the sample, the problem is blocking read on the thread but InputStream.available call always returns 0 and cannot be used to implement some ugly, busy-waiting workaround. package com.example.android.disconnectproblem; import java.io.IOException; import java.io.InputStream; import java.io.InvalidObjectException; import java.io.OutputStream; import java.util.UUID; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView;

View 7 Replies View Related

Android :: Clear Activity Stack?

Nov 3, 2009

Is there a way to clear our Activity stack? For example, a user in my app progresses through these activities, one is launched from the previous activity: ActivityA -> ActivityB -> ActivityC if the user is now looking at ActivityC, and they hit the back button, they will go back to ActivityB. Is it possible to add a menu to ActivityC where the user can clear their activity stack, and then launch a new instance of ActivityA? This would be so the user can jump to a particular activity in my application without getting confused with the back button + history,

View 4 Replies View Related

Android :: How Do I Clear All Activities From Stack?

Jul 8, 2010

I am having trouble popping all activities off the stack using ntent.FLAG_ACTIVITY_CLEAR_TOP and android:launchMode="singleInstance". In my application activity A, launches activity B (via startActivity) which in turn launches activity C (via startActivity). On activity C the user presses a menu item to return to activity A. When they arrive at activity A, I want only A on the stack such that if they click the back button they return to the home screen (desktop). This is the code that I am currently using when the user presses a button to return to A: Intent i = new Intent(this, A.class); i.addFlags(Intent.FLAG_ ACTIVITY_ CLEAR_TOP); startActivity(i); All activities are defined as android:launchMode ="single Instance" in the project manifest. My code doesn't seem to work though. Once I'm back on activity A if I click the back button I return to activity C. Am I misunderstanding how to use Intent.FLAG_ACTIVITY_CLEAR_TOP?

View 2 Replies View Related

Android :: Way To Tell When Task Goes To Back Of Stack?

Mar 23, 2009

Is there a way to tell when my task gets put on the back of the UI stack (user pressed "home" say?) I have some resources I'd like to free when not foregrounded. The lifecycle routines seem dicey to use to try and infer this. The "home" key does not seem to be passed to onKeyDown(), and moveTaskToBack() is never called by the system so I can hook it. I can poll the ActivityManager for running activities with my task id, but hard to find a good time to call this.

View 5 Replies View Related

Android :: Activity Stack Not Preserved

Mar 10, 2010

My main activity A has as set android:launchMode="singleTask" in the manifest. Now, whenever I start another activity from there, e.g. B and press the HOME BUTTON on the phone to return to the home screen and then again go back to my app, either via pressing the app's button or pressing the HOME BUTTONlong to show my most recent apps it doesn't preserve my activity stack and returns straight to A instead of the expected activity B.Is there a setting I'm missing or is this a bug? If the latter, is there a workaround for this until the bug is fixed?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved