[android-developers] Re: Garbage Collection Infinit Loop: clamp GC FOR MALLOC Grow heap loop

2010-07-08 Thread TjerkW

I am still not 100% sure what caused it but i solved it as follows.

I created a Service with a Handler. However that Handler was not in
its own thread.
So i had someting like:

public class ImageUploadService extends IntentService {
  private Handler handler = new Handler()


The service was not run in its own process. This caused the handler to
be executed in the ui thread.

The solution was to wrap the handler in a thread like this:

class UploadLooperThread extends Thread {
public Handler mHandler;

public void run() {
Looper.prepare();

mHandler = new Handler();

Looper.loop();
}
}


On Jul 8, 12:41 am, fadden fad...@android.com wrote:
 On Jul 6, 6:43 am, TjerkW tje...@gmail.com wrote:

  Basically this stops me from properly implementing a background file
  upload.
  Anybody has an idea what is going on here?

 Looks like theheapis full.  What's taking up all that space?

 Is something catching and ignoring OOM?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Garbage Collection Infinit Loop: clamp GC FOR MALLOC Grow heap loop

2010-07-07 Thread fadden
On Jul 6, 6:43 am, TjerkW tje...@gmail.com wrote:
 Basically this stops me from properly implementing a background file
 upload.
 Anybody has an idea what is going on here?

Looks like the heap is full.  What's taking up all that space?

Is something catching and ignoring OOM?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Garbage Collection Infinit Loop: clamp GC FOR MALLOC Grow heap loop

2010-07-06 Thread TjerkW
Basically this stops me from properly implementing a background file
upload.
Anybody has an idea what is going on here?

On Jul 6, 12:02 pm, TjerkW tje...@gmail.com wrote:
 I have a Service which uploads a big file to a webserver. This works
 fine on the emulator (android 2.1).

 But if i run it on a Nexus One Froyo phone it starts out fine. But
 after a while it is in an infinite GC loop.
 The whole phone becomes unusable:

 07-06 11:56:28.916: DEBUG/ImageUploadService(2351):
 onPictureUploadProgress 60
 07-06 11:56:28.987: VERBOSE/
 HyvesUpload::mediaUpload::onProgress(2351): progress: 60
 07-06 11:56:28.987: DEBUG/ImageUploadService(2351):
 onPictureUploadProgress 60
 07-06 11:56:29.057: VERBOSE/
 HyvesUpload::mediaUpload::onProgress(2351): progress: 60
 07-06 11:56:29.057: DEBUG/ImageUploadService(2351):
 onPictureUploadProgress 60
 07-06 11:56:29.127: VERBOSE/
 HyvesUpload::mediaUpload::onProgress(2351): progress: 61
 07-06 11:56:29.127: DEBUG/ImageUploadService(2351):
 onPictureUploadProgress 61
 07-06 11:56:29.196: VERBOSE/
 HyvesUpload::mediaUpload::onProgress(2351): progress: 61
 07-06 11:56:29.196: DEBUG/ImageUploadService(2351):
 onPictureUploadProgress 61
 07-06 11:56:29.476: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 25.533MB to 24.000MB
 07-06 11:56:29.476: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 14048
 objects / 515832 bytes in 240ms
 07-06 11:56:29.497: VERBOSE/
 HyvesUpload::mediaUpload::onProgress(2351): progress: 61
 07-06 11:56:29.497: DEBUG/ImageUploadService(2351):
 onPictureUploadProgress 61
 07-06 11:56:29.567: VERBOSE/
 HyvesUpload::mediaUpload::onProgress(2351): progress: 61
 07-06 11:56:29.567: DEBUG/ImageUploadService(2351):
 onPictureUploadProgress 61
 07-06 11:56:29.847: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 25.791MB to 24.000MB
 07-06 11:56:29.847: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 6001
 objects / 217168 bytes in 235ms
 07-06 11:56:29.877: VERBOSE/
 HyvesUpload::mediaUpload::onProgress(2351): progress: 62
 07-06 11:56:29.877: DEBUG/ImageUploadService(2351):
 onPictureUploadProgress 62
 07-06 11:56:30.157: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 25.911MB to 24.000MB
 07-06 11:56:30.157: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 2591
 objects / 92632 bytes in 241ms
 07-06 11:56:30.407: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 25.964MB to 24.000MB
 07-06 11:56:30.407: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 1044
 objects / 36816 bytes in 224ms
 07-06 11:56:30.407: VERBOSE/
 HyvesUpload::mediaUpload::onProgress(2351): progress: 62
 07-06 11:56:30.407: DEBUG/ImageUploadService(2351):
 onPictureUploadProgress 62
 07-06 11:56:30.657: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 25.982MB to 24.000MB
 07-06 11:56:30.657: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 509
 objects / 18232 bytes in 232ms
 07-06 11:56:30.897: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 26.000MB to 24.000MB
 07-06 11:56:30.897: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 0
 objects / 0 bytes in 240ms
 07-06 11:56:30.897: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 24.000MB to 24.000MB
 07-06 11:56:30.897: INFO/dalvikvm-heap(1872): Grow heap (frag case) to
 24.000MB for 28-byte allocation
 07-06 11:56:31.136: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 26.000MB to 24.000MB
 07-06 11:56:31.136: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 0
 objects / 0 bytes in 233ms
 07-06 11:56:31.136: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 24.000MB to 24.000MB
 07-06 11:56:31.136: INFO/dalvikvm-heap(1872): Grow heap (frag case) to
 24.000MB for 24-byte allocation
 07-06 11:56:31.377: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 26.000MB to 24.000MB
 07-06 11:56:31.377: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 0
 objects / 0 bytes in 245ms
 07-06 11:56:31.377: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 24.000MB to 24.000MB
 07-06 11:56:31.377: INFO/dalvikvm-heap(1872): Grow heap (frag case) to
 24.000MB for 28-byte allocation
 07-06 11:56:31.617: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 26.000MB to 24.000MB
 07-06 11:56:31.617: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 0
 objects / 0 bytes in 234ms
 07-06 11:56:31.617: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 24.000MB to 24.000MB
 07-06 11:56:31.617: INFO/dalvikvm-heap(1872): Grow heap (frag case) to
 24.000MB for 28-byte allocation
 07-06 11:56:31.847: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 26.000MB to 24.000MB
 07-06 11:56:31.847: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 0
 objects / 0 bytes in 234ms
 07-06 11:56:31.847: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 24.000MB to 24.000MB
 07-06 11:56:31.847: INFO/dalvikvm-heap(1872): Grow heap (frag case) to
 24.000MB for 28-byte allocation
 07-06 11:56:32.097: INFO/dalvikvm-heap(1872): Clamp target GC heap
 from 26.000MB to 24.000MB
 07-06 11:56:32.097: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 1
 objects / 32 bytes in 243ms
 07-06 11:56:32.097: 

[android-developers] Re: Garbage Collection Infinit Loop: clamp GC FOR MALLOC Grow heap loop

2010-07-06 Thread sws-vinpa
TjerkW:

I am wondering, are you using sockets for this type of application?

I have run into a similar problem where a front-end application
written on Android in Java connects through a socket to a back-end
server (not a Service, in Android terms) written in C.  During
stress-testing, I killed my server to see how the app would react.
When I did this, the device would flood logcat with GCC freed blah
blah blah.  This was because I had a separate thread which ran once
it connected, it would send a request for data, expecting to receive
something back from a server that was no longer there.

Perhaps your application or web server believes it is still connected,
has a process running that is trying to send/receive data, or similar.


Regards,

sws-vinpa.


On Jul 6, 9:43 am, TjerkW tje...@gmail.com wrote:
 Basically this stops me from properly implementing a background file
 upload.
 Anybody has an idea what is going on here?

 On Jul 6, 12:02 pm, TjerkW tje...@gmail.com wrote: I have a Service which 
 uploads a big file to a webserver. This works
  fine on the emulator (android 2.1).

  But if i run it on a Nexus One Froyo phone it starts out fine. But
  after a while it is in an infinite GC loop.
  The whole phone becomes unusable:

  07-06 11:56:28.916: DEBUG/ImageUploadService(2351):
  onPictureUploadProgress 60
  07-06 11:56:28.987: VERBOSE/
  HyvesUpload::mediaUpload::onProgress(2351): progress: 60
  07-06 11:56:28.987: DEBUG/ImageUploadService(2351):
  onPictureUploadProgress 60
  07-06 11:56:29.057: VERBOSE/
  HyvesUpload::mediaUpload::onProgress(2351): progress: 60
  07-06 11:56:29.057: DEBUG/ImageUploadService(2351):
  onPictureUploadProgress 60
  07-06 11:56:29.127: VERBOSE/
  HyvesUpload::mediaUpload::onProgress(2351): progress: 61
  07-06 11:56:29.127: DEBUG/ImageUploadService(2351):
  onPictureUploadProgress 61
  07-06 11:56:29.196: VERBOSE/
  HyvesUpload::mediaUpload::onProgress(2351): progress: 61
  07-06 11:56:29.196: DEBUG/ImageUploadService(2351):
  onPictureUploadProgress 61
  07-06 11:56:29.476: INFO/dalvikvm-heap(1872): Clamp target GC heap
  from 25.533MB to 24.000MB
  07-06 11:56:29.476: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 14048
  objects / 515832 bytes in 240ms
  07-06 11:56:29.497: VERBOSE/
  HyvesUpload::mediaUpload::onProgress(2351): progress: 61
  07-06 11:56:29.497: DEBUG/ImageUploadService(2351):
  onPictureUploadProgress 61
  07-06 11:56:29.567: VERBOSE/
  HyvesUpload::mediaUpload::onProgress(2351): progress: 61
  07-06 11:56:29.567: DEBUG/ImageUploadService(2351):
  onPictureUploadProgress 61
  07-06 11:56:29.847: INFO/dalvikvm-heap(1872): Clamp target GC heap
  from 25.791MB to 24.000MB
  07-06 11:56:29.847: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 6001
  objects / 217168 bytes in 235ms
  07-06 11:56:29.877: VERBOSE/
  HyvesUpload::mediaUpload::onProgress(2351): progress: 62
  07-06 11:56:29.877: DEBUG/ImageUploadService(2351):
  onPictureUploadProgress 62
  07-06 11:56:30.157: INFO/dalvikvm-heap(1872): Clamp target GC heap
  from 25.911MB to 24.000MB
  07-06 11:56:30.157: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 2591
  objects / 92632 bytes in 241ms
  07-06 11:56:30.407: INFO/dalvikvm-heap(1872): Clamp target GC heap
  from 25.964MB to 24.000MB
  07-06 11:56:30.407: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 1044
  objects / 36816 bytes in 224ms
  07-06 11:56:30.407: VERBOSE/
  HyvesUpload::mediaUpload::onProgress(2351): progress: 62
  07-06 11:56:30.407: DEBUG/ImageUploadService(2351):
  onPictureUploadProgress 62
  07-06 11:56:30.657: INFO/dalvikvm-heap(1872): Clamp target GC heap
  from 25.982MB to 24.000MB
  07-06 11:56:30.657: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 509
  objects / 18232 bytes in 232ms
  07-06 11:56:30.897: INFO/dalvikvm-heap(1872): Clamp target GC heap
  from 26.000MB to 24.000MB
  07-06 11:56:30.897: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 0
  objects / 0 bytes in 240ms
  07-06 11:56:30.897: INFO/dalvikvm-heap(1872): Clamp target GC heap
  from 24.000MB to 24.000MB
  07-06 11:56:30.897: INFO/dalvikvm-heap(1872): Grow heap (frag case) to
  24.000MB for 28-byte allocation
  07-06 11:56:31.136: INFO/dalvikvm-heap(1872): Clamp target GC heap
  from 26.000MB to 24.000MB
  07-06 11:56:31.136: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 0
  objects / 0 bytes in 233ms
  07-06 11:56:31.136: INFO/dalvikvm-heap(1872): Clamp target GC heap
  from 24.000MB to 24.000MB
  07-06 11:56:31.136: INFO/dalvikvm-heap(1872): Grow heap (frag case) to
  24.000MB for 24-byte allocation
  07-06 11:56:31.377: INFO/dalvikvm-heap(1872): Clamp target GC heap
  from 26.000MB to 24.000MB
  07-06 11:56:31.377: DEBUG/dalvikvm(1872): GC_FOR_MALLOC freed 0
  objects / 0 bytes in 245ms
  07-06 11:56:31.377: INFO/dalvikvm-heap(1872): Clamp target GC heap
  from 24.000MB to 24.000MB
  07-06 11:56:31.377: INFO/dalvikvm-heap(1872): Grow heap (frag case) to
  24.000MB for 28-byte allocation
  07-06 11:56:31.617: INFO/dalvikvm-heap(1872): Clamp target GC heap
  from 26.000MB to 

[android-developers] Re: Garbage Collection

2009-08-19 Thread Carl Whalley

You don't have to call it yourself, but you can if you want to give it
a hint that right now would be a good time to clean up. Even then,
there is no guarantee it will do anything. Heres an example - say you
have an action game which does the minimum possible (but still some)
allocations during play, then pauses at an end of level dialog. If
gc didn't run, during the next level, its new allocations might
trigger one just when you don't want it. So as the user is paused at
the dialog anyway, a call to System.gc() could help by clearing up
from the first level.

--
Android Academy http://androidacademy.com

On Aug 18, 10:36 pm, human android vanquisher.sin...@gmail.com
wrote:
 Do I have to make explicit calls to do garbage collection?
 runtime.gcSoftReferences()
 runtime.runFinalizationSync()

 Doesn't javas automatic garbage collection take care of it on its own?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Garbage Collection

2009-08-19 Thread fadden

On Aug 18, 5:56 pm, vanquisher sinner vanquisher.sin...@gmail.com
wrote:
 For every application there seems to be a HeapWorker thread which does
 all the GC.

The HeapWorker thread runs finalizers and occasionally releases empty
4K pages back to the system.  The GC runs when an allocation bumps up
against the current heap limit, or when explicitly requested by an
application.

(All of which is subject to change in a future release.)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Garbage Collection

2009-08-18 Thread Yusuf Saib (T-Mobile USA)

No, you do not have to make calls to it. You are correct, the JVM does
that on its own.



Yusuf Saib
Android
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



On Aug 18, 2:36 pm, human android vanquisher.sin...@gmail.com wrote:
 Do I have to make explicit calls to do garbage collection?
 runtime.gcSoftReferences()
 runtime.runFinalizationSync()

 Doesn't javas automatic garbage collection take care of it on its own?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Garbage Collection

2009-08-18 Thread vanquisher sinner

For every application there seems to be a HeapWorker thread which does
all the GC.

On Tue, Aug 18, 2009 at 2:56 PM, Yusuf Saib (T-Mobile
USA)yusuf.s...@t-mobile.com wrote:

 No, you do not have to make calls to it. You are correct, the JVM does
 that on its own.



 Yusuf Saib
 Android
 ·T· · ·Mobile· stick together
 The views, opinions and statements in this email are those of the
 author solely in their individual capacity, and do not necessarily
 represent those of T-Mobile USA, Inc.



 On Aug 18, 2:36 pm, human android vanquisher.sin...@gmail.com wrote:
 Do I have to make explicit calls to do garbage collection?
 runtime.gcSoftReferences()
 runtime.runFinalizationSync()

 Doesn't javas automatic garbage collection take care of it on its own?
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---