Android :: Force Garbage Collection To Happen At Convenient Time?
Apr 15, 2009
I have screen 1 of my app which I want to transition smoothly into screen 2.
I want the transition to be smooth but I don't mind a slight pause before or after the transition. Before the transition I dump a lot of objects that are no longer needed from screen 1.
However, as luck would have it (!), the garbage collection almost always takes place during the transition causing the frame rate to drop and the transition looks terrible :(
Is there a way for me to either force the garbage collection to complete before the transition or delay until after the transition is finished? I have tried System.gc() in various places but it doesn't seem to help performance.
View 2 Replies
Jun 6, 2010
I'm writing an Augmented Reality codes that should works in realtime,
But the VM's garbage collection hinders my program's performance.
I checked my program's execution time for each in OnPrevFrame(byte[], Camera)
and it execution time increases from around 50ms to 120ms at just after each garbage collection.
I copied parts of logs below. (local time is just before and after of signal processing, and global time is time stamps for every onPreviewFrame() calling )Also I executed onPreviewFrame without any signal processing on it, but
the garbage collection is also carried showing debugging message around 60ms it spends for memory release.
Is this garbage collection come from releasing byte[] yuvs image data? ( i uses 320x240 thumb nail )
then this clearly comes from Java's limitation, so there will be no hope for improvement unless
I found a way to directly access camera device? do you think this is feasible? Hope listen to others' comments.
View 3 Replies
View Related
Dec 28, 2009
I'm drawing a rect to a surfaceview. Nothing special, just a test like this, in the surfaceview-extended class:
private int mPosX = 0; private Paint mPaint = new Paint(); Code...
the rect just bounces around the screen. I'm watching DDMS, I still see the garbage collector being called, even with this simple draw loop. There is no other application code being executed.
I'm wondering if it's realistic to expect the gc to not be called at all if we take care to not allocate any objects during our draw loops. I'm trying to extend this example to do some smooth animations, but every once in awhile the gc is called and you can see the drawing stutter. Although none of my application code is allocating any new objects, I don't know what the underlying API is doing inside surfaceview etc, and I doubt we can control that. Just wondering if this is not possible, I'd prefer to abandon this game idea up-front if we can't guarantee smooth animation.
View 5 Replies
View Related
May 25, 2009
I am developing a camera application , where the frame rate is important. However, camera uses a preview callback function which allocates a byte[] array of 230400 bytes, which makes it necessary for the garbage collection to step in. Can someone suggest me a way to avoid garbage collection stepping in?
View 10 Replies
View Related
May 20, 2009
Hi, I have discovered while using DDMS that the basic OpenGL system calls in my code are allocating memory and causing the garbage collector to fire! It's not the system calls themselves causing the problem but the use of direct byte buffers to pass data in.
The direct byte buffers I use in calls such as glVertexPointer & glTexCoordPointer lead to java.nio calls to read the byte buffers, leading to objects of type org.apache.harmony.luni.platform.PlatformAddress being created.
These buffers are the same as in the example OpenGL code. I am creating a ByteBuffer using allocateDirect() and then creating an IntBuffer using ByteBuffer.asIntBuffer() to pass data to the OpenGL functions. The problem occurs as the system is reading the buffers.
Is there a way around this? Maybe using something other than direct byte buffers? It seems that using this method, OpenGL code of any complexity (ie a lot of OpenGL system calls in every frame) is doomed to pause a lot. I am aware that these calls should be kept to a minimum, but I still need to use a certain amount of them.
View 9 Replies
View Related
Mar 20, 2010
I'm performance tuning interactive games in Java for the Android platform. Once in a while there is a hiccup in drawing and interaction for garbage collection. Usually it's less than one tenth of a second, but sometimes it can be as large as 200ms on very slow devices. I am using the ddms profiler (part of the Android SDK) to search out where my memory allocations come from and excise them from my inner drawing and logic loops. The worst offender had been short loops done like,
for(GameObject gob : interactiveObjects)
gob.onDraw(canvas);........................
View 3 Replies
View Related
Jul 6, 2010
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:.........................
View 5 Replies
View Related
Apr 13, 2009
In my ListView, there's one line of code in my ViewBinder that causes lots of garbage collection as I scroll through the list, about every two seconds...
D/dalvikvm(16312): GC freed 13171 objects / 659576 bytes in 162ms D/dalvikvm(16312): GC freed 13122 objects / 654128 bytes in 129ms D/dalvikvm(16312): GC freed 13134 objects / 655416 bytes in 142ms D/dalvikvm(16312): GC freed 13129 objects / 654840 bytes in 129ms D/dalvikvm(16312): GC freed 13149 objects / 655000 bytes in 110ms D/dalvikvm(16312): GC freed 13150 objects / 655720 bytes in 127ms D/dalvikvm(16312): GC freed 13075 objects / 652256 bytes in 111ms D/dalvikvm(16312): GC freed 13232 objects / 659040 bytes in 136ms D/dalvikvm(16312): GC freed 13106 objects / 653920 bytes in 110ms D/dalvikvm(16312): GC freed 13155 objects / 655152 bytes in 110ms
The offending code is here, which formats a price for each item in the list: String price = cursor.getString(columnIndex); final float pricef = Float.parseFloat(price); price = new StringBuffer("$").append(String.format("%. 2f",pricef)).toString(); ((TextView)view).setText(price);
If I comment out the line with String.format, the garbage collection goes away. So what's the "right" way to do this to avoid allocations? That database field holds an unformatted text string which I'm trying to format into proper currency format (example: format "1.5" to "$1.50")
View 9 Replies
View Related
Jul 29, 2010
I get this error all the time when using apps or putting apps on my home screen or doing almost anything. I'm using cm6 And snapv3.
View 2 Replies
View Related
Oct 14, 2010
I have a service which runs in the background when the user starts using my app. I am using it to do some posts to our server. I always close my service by calling stopSelf as soon as the posts have been made or failed.
But I recently observed two times that my service did not stop. I saw that in the running services in settings on my device that it has been sitting there for over a few hours.
So I was trying to see if I can alternatively set a timer using which I can force the service to stop after a few minutes no matter what.
View 3 Replies
View Related
Sep 29, 2010
I've narrowed down the problem to WebView; my application force closes every time. If I take out the WebView and put in a color change button or something, the case switching works and the application loads. I'm fairly new to the plaform, but I'm (mostly) copying directly from examples here for WebViews.
CODE:........
main.xml
CODE:............
AndroidManifest.xml
CODE:.................
View 1 Replies
View Related
Nov 23, 2009
I'm trying to guess why a user would report "Force quits every time I load" the problem does not occur for all users, especially not me.The system constructs a database when it first loads. I suspect that user's phone does not have enough memory.Questions: How can I verify that the system has enough memory to store a small database?
What else might cause a user's particular system to force quit on startup?Wrong answers or things I've tried thus far:The user's hardware is probably different than mine The user's software and available memory is likely different as well The data is already loading in its own thread, with a progress dialog showing
View 4 Replies
View Related
Feb 24, 2012
I deliberately set wrong time on my device and whatever I do it keeps this wrong time. What button need I press, what precise steps should I take to force it get atomic time? Can it synchronize himself over wifi network or it can only over mobile?
View 1 Replies
View Related
Nov 30, 2009
new to the moto droid need some help w/ ringdroid .... from what i read it's the best app for custom ringtones but every time i open it it'll force close (i'm on my 2nd droid and it's happening on both of them) any other apps out there that can help me w/ ringtones or what can i do to make ringdroid work on my droid
View 5 Replies
View Related
Aug 18, 2010
Froyd villain1.2.2 stock messenger force closes so
I tryed chomp and I can send text but not revive messages . if I cant fix this I will have to go back to 2.1 Villain 12. what can I try ?
PS I tried to post a bug report on Villains forum but it wont let me post I just get errors
View 4 Replies
View Related
Jan 26, 2012
Titanium backup force closes every time when I start it. I made a logcat.
--------- beginning of /dev/log/system
W/InputManagerService( 289): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$ Proxy@2b3f1e80
I/Elixir ( 6274): WidgetUpdateService started
D/Elixir ( 6274): WidgetUpdateTask update widgets: [12, 11], all: true, forceUpdate: false
[Code] ........
View 6 Replies
View Related
Aug 18, 2010
Assume that, I have a TCP connection that doing heavy data transmitting on my 3G network; and I walked home, Android switch to my home Wifi automatically. Now what happen to the existing connection? is it simply disconnect? or it will keep going, only the new connections will use wifi?
View 2 Replies
View Related
Feb 5, 2009
I try to create a mini player view on home screen and still use the music mediaplayback service by putting a IMediaPlaybackService aidl in home directory. the mini player can normally playback and control the music, but often meet the anr(com.android.music) and see below log.
CODE:....................
View 2 Replies
View Related
Apr 23, 2010
Just an FYI - don't update to the latest Facebook App version. It force closes every time even after reboots & reinstalls.
View 10 Replies
View Related
Jan 21, 2010
My calendar has started to "force close" about 1 time per day now. the problem started about 1 week ago. anyone else have this issue?
View 2 Replies
View Related
Sep 24, 2010
I recently loaded Baked Snack 1.7 on my phone as my first custom ROM - before that I had rooted stock Froyo. I tried two Baked Snack kernels and now have KingsxKlick bfs #9.
So I have all these variables and now I have a weird problem - my address book is force-closing on me every time I try to create a new contact. I haven't created a new contact in awhile, so I have no idea whether this could be related to my new ROM or kernel, or if it's a problem with the address book itself. I have had no other problems since installing the ROM and kernel.
I can input the new number for the contact, but when I try to name the contact it says it has encountered an error and needs to stop. This is the stock HTC People app, and I have tried it creating the contact as a regular phone contact and as a Google contact. No dice.
I've also tried a battery pull, clearing cache, the basics.
Any thoughts, guys? I met a cute boy and I REALLY need to save his number.
View 23 Replies
View Related
Jul 27, 2010
Love the X10 but cannot get mediascape to work, get force close message each time. Sony not responded to any of my emails and when I called they were not that helpful, could only suggest I restore to factory settings. Do not really want to do that.
View 2 Replies
View Related
Sep 6, 2012
i have a samsung galaxy gio GT-S5660M Android version 2.3.4 build number GINGERBREAD.MUGKG3 (Stock rom gingerbread ) but it is rooted. ok so i was trying to free up some space on my internal memory and i was using titanium back up and i converted google play to a user app (it took too long so i assumed it didn't work) but i backup the google play. i was able to move it to sd card thought ,but then i still don't have enought free memory to receive text msg (20mb needed) so i did a factory reset which freed up everything. and i was still rooted ( i fixed it) but now google play won't open it gives me this message (process com,android,vending) so i downloaded a new com.android.vending but still won't work i tried the clear data it will open and i can search but whenever i try to download it will force close.
View 5 Replies
View Related
Aug 5, 2010
Sorry if this has been asked before -
With the ease of the unrevoked root method, I'm thinking about rooting my Incredible.
I'm by no means an advanced user (command line what?), but would definitely like to download some of the more popular root-only applications.
I have no intentions of messing with new roms/kernels...just wifi tethering, nandroid, etc.
What will happen when the official Froyo update comes out? Will I be able to upgrade without trouble?
I've looked at the sticky about reverting to stock in case something goes wrong, and it looks a little over my head. Will I have to do that to enjoy the official Froyo update?
View 3 Replies
View Related
May 27, 2010
I have an app with about 15 threads. Most do mundane tasks and sleep most of their lives. Others collect information and cache it in hashmaps. The hashmaps grow to a moderate size and level out. The number of keys and size of value remains constant, but the contents of the values changes (at 33 keys per second average). When I start my app, I notice the garbage collection interval goes from minutes to once per second, and the amount of garbage is 700k+ each time. In fact as I was writing this, it caused my phone to reboot with an error "Referencetable Overflow". Here's my question: Are there any tricks to identifying which threads are producing the garbage, or even finding out more about what garbage they are producing?
05-26 22:08:57.052 W/dalvikvm( 1031): ReferenceTable overflow (max=512)
05-26 22:08:57.052 W/dalvikvm( 1031): Last 10 entries in JNI local reference table:
05-26 22:08:57.052 W/dalvikvm( 1031): 502: 0x449904a8 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.052 W/dalvikvm( 1031): 503: 0x4494fda8 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.052 W/dalvikvm( 1031): 504: 0x44a172c8 cls=Ljava/lang/String; (28 bytes)
05-26 22:08:57.052 W/dalvikvm( 1031): 505: 0x448c7900 cls=Ljava/lang/String; (28 bytes)........
View 2 Replies
View Related
Oct 12, 2010
I lost my Desire - gutted, but it's insured so hopefully I'll have a replacement soon. Anyway, I want to know if there's a way to get back the apps that I had installed on it - will the marketplace recognise it's me and offer me all the ones I had installed, or do I just have to remember which ones I installed (paid and free) and go and find them again? If so, is there a list recorded anywhere in my google account? In hindsight, a kinda nice thing about the apple app store is that you get a receipt for everything you install, so that's kind of useful.
View 7 Replies
View Related
May 20, 2010
Will people smarter than me be able to create an exact replica of the HTC rom that suitable for flashing onto phones that boot the recovery image, so it retains the recovery image? (and thus keeping open the possibility of moving a any future homebrew 2.2 images etc). ill people smarter than me be able to extract the radio firmware for updating?Whilst i'm reasonably happy with the current hacked firmwares, they are all quite buggy in places, and would love to pickup something that is IDENTICAL to stock, aside from giving me root and the ability to change again in the future...
View 10 Replies
View Related
Mar 5, 2013
What generally happens in the Android System, when i switch on or off the USB Debugging? Is there a constant in the Android System Configuration, wich is turn on or off? How can the adb attached the devices, wich are turn on USB Debugging?
View 2 Replies
View Related
Feb 11, 2010
Was looking for some guidance here. I need to replace the garbage keyboard bundled with 1.6 for something else. Which in your opinion is the best replacement and why? Maybe some comparisons would help also. Oh, by the way i'm running a mytouch 3g!
View 28 Replies
View Related
Jul 29, 2009
I didn't use much Java before Android so my knowledge concerning the gc is marginal. Now I'm developing a highly physics-based game and therefore I need to do many calculations each time step and many (25) time steps per second. At the moment I'm almost only using local objects (float) in my methods, so I guess they are allocated every time the method is called (which might be, for example, 25*100 = 2500 times a second , for 100 objects with calculations on them). This causes massive activity of the garbage collector like freeing ~10000 objects every 1-2 seconds (taking ~200ms on a real device). Now I really want to optimize that because even there's no noticeable delay due to the GC (and the frame rate is constant), this seems just not well. But I read on many documentations concerning Java optimization, that there is not much to optimize in modern versions of (desktop) Java, because the GC is fast enough. Does this apply to Android, too? Does the compiler optimize anything like frequently, steady allocated objects (like floats)? What would be best practice: keep all local objects and allocate and free them all the time or use class-global objects, even if they are only used inside one particular method (which is bad programming style but conserves GC?
View 5 Replies
View Related