Android :: Droid Camera Garbage Collection / Way To Avoid It

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?

Android :: Droid Camera Garbage Collection / way to avoid it


Android :: Avoid Garbage Collection Delays In Java Games?

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

Android : Latency Due To Garbage Collection On On PrevFrame

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

Android :: Avoiding Garbage Collection For Smooth 2d Animations

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

Android : OpenGL Garbage Collection - With Direct ByteBuffers

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

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 View Related

Android :: Garbage Collection Infinite Loop - Clamp GC FOR MALLOC Grow Heap

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

Android :: One Line Causing Lots Of Garbage Collection.String.format With Float?

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

Android :: How To Avoid Camera Landscape Mode?

Nov 24, 2010

I am New To android, my problem is when iam capturing image programetically the camera is opening in landscape mode..Than How to Avoid it?

View 1 Replies View Related

Android :: How To Avoid Blank Screen On Pause Camera Preview

Jun 18, 2009

I'm running a standard camera preview (i use the camera api demo as a reference).

When i hit the capture button, there is a black screen for a good 1/2 second until the captured image appears.

My question is how can i freeze the last image being previewed on the screen while i do the capture work ? I don't mind that the quality of the displayed image is not as good.

If i hit camera.stopPreview() -> that goes into the black screen which i don't want.

View 2 Replies View Related

Android :: Possible To Stop Droid Garbage Collector?

May 21, 2010

Is there any way to stop the garbage collector for some time?

View 2 Replies View Related

Android : Are Primitive Types Garbage Collected In Droid?

Mar 18, 2010

I know this may be a dumb question, but my background is more in c++ and managing my own memory.

I am currently cutting down every single allocation that I can from one of my games to try and reduce the frequency of garbage collection and perceived "lag", so for every variable that I create that is an Object (String for example) I am making sure that I create it before hand in my constructor and not create temporary variables in simple 10 line functions... (I hope that makes sense)

Anyways I was working though it some more tonight and I realized that I a may be completely wrong about my assumption on garbage collection and primitive types (int, boolean, float) are these primitive type variables that I create in a 10 line function that gets called 20 times a second adding to my problem of garbage collection?

View 2 Replies View Related

Android : Data Collection With Droid Via USB?

Jul 17, 2009

What would be the best way to access the USB as a serial port on a android device (HTC Magic) ?
I am thinking about a OBD-II interface, can I do this on a startdard phone or more likely I'll need a modified firmware ?

View 7 Replies View Related

Android :: Want Droid Collection Andrew Bell

Aug 14, 2010

Does anyone have any of andrew bells android google mini figurines that they don't want. I'm looking to buy some specific ones.

View 11 Replies View Related

Motorola Droid X :: Need DVD Collection App

Aug 6, 2010

Anyone know of such an app? It sure would be nice to have a list on my DX when I'm in a store to ensure I don't buy any dupes.

View 5 Replies View Related

Motorola Droid X :: Audio Sounds Like Garbage Through Car Speakers / What To Do?

Sep 1, 2010

I started having an issue a couple days ago (after not making any changes to any settings) where anything with the slightest hint of.bass sounds awful in the car. It sounds fine on headphones, and the same car adapter I use on the DX sounds just fine with other devices through the same speakers. Doesnt matter if I use Pandora or the native music app. What gives? I checked my audio effects settings already and no changes there help. Im baffled because all the things that could be wrong work fine with other devices.

View 7 Replies View Related

HTC Incredible :: How To Get Droid Collection Icon Pack To Work?

Aug 21, 2010

How do get these to work I tried using better cut but can't figure it out [Icon_Pack]. The Droid Collection_v1.0-xda-developers.

View 4 Replies View Related

Android :: Thread(s) Producing Garbage?

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

Android :: Need To Replace Garbage Keyboard Bundled With 1.6

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

Android :: Garbage Collector Conservation - Best Practice

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

Android :: Timer Does Not Stop In Droid / Avoid This?

Mar 4, 2010

I made an application in android and used timer like this. code...

View 1 Replies View Related

Android :: Glbuffersubdata With An Offset Into Buffer Without Causing Garbage

Aug 1, 2010

I'm trying to update part of a VBO with a call to glBufferSubData(). When I update from the start (0) of my existing shadow buffer, there is no problem, as the buffer starts reading from 0. The following will read 0 to y from the buffer and place it at 0 to y in the VBO: gl.glBufferSubData(GL11.GL_ARRAY_BUFFER, 0, y, mPositionBuffer);

However, if I want to update a portion of the VBO (not from 0) I run into a problem; The following doesn't work, since it will write the values from the start of the buffer (0 to y) into position x to x+y of the VBO:........................

View 1 Replies View Related

Android :: Getting Errors Building Droid Project With Ant / Way To Avoid This?

Jun 15, 2010

Now that I sort of know my way around the SDK/API, I've switched from Eclipse back to my favorite text editor, which means I have to use ant to build my project, however:

It seems every other time I compile the project, a lot of drawables get corrupted, resources lose their ids (resulting in NPEs in the code), or classes throw "Verify Errors".

The only way to fix this is by removing the bin and gen folders, and recompiling, which is obviously annoying.

Is there any way to avoid this?

btw, I'm using ant 1.7.1, java version "1.6.0_20"

View 1 Replies View Related

Android :: Particular Collection Of Code Along With Some XML Files

Jun 4, 2010

I have a particular collection of code along with some XML files that I need to share with every application I will make.

At the moment I can't because as far as I am aware there is no way to do this. This seems like a massive oversight by the development team.

If the code needs changing, I have to change it in every app that I create - and will create in the future.

Are there any ways to share code in android yet? I am using Eclipse for development.

View 3 Replies View Related

Android :: Print Integer To Canvas Fast And Without Garbage Collects?

Nov 24, 2010

I have a tight game loop in a separate thread where I paint a lot of things on the canvas.

When I paint the score to the canvas I use the following function code...

When I check allocations in ddms I see that .toString not totally unsurprising allocates a char array on each conversion from an Integer to a String. This array will eventually be claimed by the garbage collect and cause uneven rendering of frames on slow android devices.

Is there a better way of painting integers on a canvas that won't cause new allocations and garbage collects?

View 1 Replies View Related

Media :: Sync Your Music Collection To Android

Jan 8, 2009

Ok before you start salivating and jumping up and down like a hysterical clown, read the following disclaimer

"At the moment you can not do this, but very soon you will. In fact it is being developed as we speak"

Still interested? Read on

Mozilla, our (second) favourite web browser has had an open source media library and player for some time ( called songbird ). The interface looks cunningly similar to i-tunes, and keeping in tradition with mozilla's theme and addon creation the plugins, themes and addons are pouring in.

According the their roadmap support for extrnal USB devices like mp3 players, cellphones and PDA's is coming very soon, in the next development phase. Which means one thing for you and me, the ability to sync our media collection with our G1's

View 3 Replies View Related

Android :: Where To Find Girlson Collection For Phone?

Sep 4, 2010

Now that girls in home, girls on river, etc have been removed from the market can someone tell me where I can find them?

View 2 Replies View Related

Android :: MotionEvent And KeyEvent Causing Excessive Garbage Collect (GC) Calls

Jan 3, 2010

I'm running into some issues with input events and garbage collection, or more precisely object allocation. I am creating a game and have pretty much got my head around the OpenGL environment. I've digested all the relevant material I could find regarding performance, memory allocation etc (and watched the excellent presentation by Chris Pruett - http://code.google.com/events/io/2009/sessions/WritingRealTimeGamesAn...). I've pretty much eliminated any object allocations after initial setup from my game (which is still in its infancy), but I'm still getting a bunch of GC calls, like this:...........................

View 6 Replies View Related

Android :: Itemized Overlays - Not Drawing Collection But Refreshing?

Apr 22, 2010

I'm trying to write code that draws accuracy circles around a gps location based on a time param. I have no problem setting up the GPS, or of calculating how to draw the circles.What's been killing me is that the Overlays always overwrite one another.So I can never have more than one circle.I've looked at all the examples and tutorials online but they seem to be obsessed with putting in icons or with Drawing from some database or array.If I understood correctly I should be able to do itemizedoverlays and just draw as i go without having to track each readout in an array.

View 9 Replies View Related

Android :: Bind A ListView To Collection Of Custom Objects?

Feb 23, 2010

I've got a class called PhoneContact with 3 properties:
Title, Description and PhoneNumber

If I have a collection of these, how would I go about binding these to a ListView containing a TextView for each property?

View 1 Replies View Related







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