Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Avoiding garbage collector in Android  (Read 3537 times)
0 Members and 1 Guest are viewing this topic.
Offline shaylev

Junior Newbie





« Posted 2010-03-04 03:55:42 »

Hi,

 I am building a game for android that requires me to use a physics engine (I am using Phys2D). Before creating the physics world I get a frame rate of more than 60fps. Once I create the world and start it in the game loop I get a sharp decrease in the frame rate (drops to ~20). I think that the sharp decrease is due to the fact that the Garbage collector is working like crazy after the world is created.

Is there a way around it? is there some other way I can create the physics world without having the Garbage collector working all the time?

Thanks
Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #1 - Posted 2010-03-04 05:44:53 »

Run ddms in the SDK tools directory (not through Eclipse). You can use the allocation tracker to see what garbage collection is going on.

I don't have experience with Phys2D specifically.

Offline EgonOlsen
« Reply #2 - Posted 2010-03-04 07:04:49 »

Remember that those devices don't have a fpu, so everything using floats (or doubles) will be quite slow. Maybe that's the reason for your slowdown after enabling physics, which will most likely use floating point.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kevglass

JGO Kernel


Medals: 120
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #3 - Posted 2010-03-04 07:40:59 »

Could be either. Phys2D is float based but is also none to create alot of gargabe in the form of lots of tiny objects. On the desktop this doesn't hurt too much (given the way GC works on small short lived objects) but on Android this is likely to cause alot of pain.

Have you considered JBox2D? Thats considered to have a lot of less garbage.

Kev

Offline teletubo
« League of Dukes »

JGO Ninja


Medals: 48
Projects: 4
Exp: 8 years



« Reply #4 - Posted 2010-03-04 17:40:56 »

Before I implemented my own dirty-but-fast physics engine to my android game (which I will release in 2 weeks or so), I tried using Phys2D . I dont think the problem is the garbage collection, but the engine itself which is pretty acurrate, thus pretty processor consuming .
When I tried running Phys2D with just a few entities, I got barely 5 FPS on my HTC Hero, with most basic rendering.
Maybe I was doing something wrong, but I even tried reducing the number of steps, but no success .

@kevglass have u tried running your lib in Android? Do u think there's a way it can run on it with a reasonable framerate?

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (6 views)
2014-07-29 12:53:52

Dwinin (7 views)
2014-07-29 10:59:34

E.R. Fleming (21 views)
2014-07-29 03:07:13

E.R. Fleming (8 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (51 views)
2014-07-17 23:47:54
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!