Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (117)
games submitted by our members
Games in WIP (564)
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  
  Online Garbage Collection Article  (Read 3893 times)
0 Members and 1 Guest are viewing this topic.
Offline Andrew Davison

Junior Member


Medals: 2



« Posted 2005-11-23 02:06:13 »

Dear All,

I've just added an appendix to the Killer Game Programming in Java website about how to detect memory leaks and reduce garbage collection pauses.

It's Appendix C, at the very bottom of the main page:
  http://fivedots.coe.psu.ac.th/~ad/jg/

Comments are appreciated.

- Andrew

Dr. Andrew Davison
Dept. of Computer Engineering
Prince of Songkla University, Hat Yai
Songkhla 90112, Thailand
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #1 - Posted 2005-11-23 04:00:47 »

I've only skimmed some key parts but it looks very good so far.

It might be a good idea to mention the new profiler for NetBeans 5, even though it is still in beta.

Offline Raghar

Junior Member




Ue ni taete 'ru hitomi ni kono mi wa dou utsuru


« Reply #2 - Posted 2005-11-23 22:54:38 »

Is there any reason to don't post a HTML version of that pdf file?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #3 - Posted 2005-11-24 00:22:55 »

Just a question 'cause Im udner deadline and generally lazy Cool

Do you talk about the newspace and the difference between short lived and long-lived objects at all? (Sometimes called the "eden".)

From JDK5 forward I have had no gc pause problems at all by simply following two simple rules.  Obejcts should be EITHER short lived or very long lived.  Short lived objects are generally colletable without apparent pauses.  Long lived ones can cause pauses and therefor should be treated like memory allocation in C and only released during pause periods like level changes.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #4 - Posted 2005-11-24 00:36:44 »

From JDK5 forward I have had no gc pause problems at all by simply following two simpel rules.  Obejcts should be EITHER short lived or very long lived.  SHort lived objects are generally colletable without apparent pauses.
Exactly what are you classifying as 'short lived'? Recently (particularly for my scrolly shooter) I've only really worried about avoiding *really* short lived objects (mainly temporary Vector2f etc. used for per enemy/bullet per frame updates). Stuff like bullets - which can easily have multiple new objects per frame, and last for a couple of seconds - I can happily new and discard without any noticable framerate hit or jerkyness. And all without any sort of GC tuning I might add. Cool

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Andrew Davison

Junior Member


Medals: 2



« Reply #5 - Posted 2005-11-24 02:04:44 »

The article  uses standalone visualization tools, so doesn't talk about support in NetBeans, Eclipse, etc.

I use PDF because it's a cross-platform format that's easy to generate from MS Word, and still looks like the original document.

There's a lot about short and long-lived objects in the article.

Short-lived objects are collected from the young generation space (new space) after a few seconds. If they live longer, they'll eventually be moved to the old generation space (tenured space). GC from the tenured space can be a factor of 10 slower than the new space, so it may be useful to adjust the space sizes to keep objects in the new space.

But, like everything, if your application doesn't have a problem with GC, then there's no need to fine-tune it.

- Andrew

Dr. Andrew Davison
Dept. of Computer Engineering
Prince of Songkla University, Hat Yai
Songkhla 90112, Thailand
Offline Jeff

JGO Coder




Got any cats?


« Reply #6 - Posted 2005-11-24 02:07:17 »

From JDK5 forward I have had no gc pause problems at all by simply following two simpel rules.  Obejcts should be EITHER short lived or very long lived.  SHort lived objects are generally colletable without apparent pauses.
Exactly what are you classifying as 'short lived'? Recently (particularly for my scrolly shooter) I've only really worried about avoiding *really* short lived objects (mainly temporary Vector2f etc. used for per enemy/bullet per frame updates).

Yup.  And I wouldnt even worry about those unless the cost of creating them is heavyweight.

In a quick and dirty port of a game app i have to write a fake socket provider layer and was allocating multiple Buffer objects all up and down the chain for each pcaket.

I saw NO hit Cool

I love the newspace and how they finally have it tuned Smiley

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline princec

JGO Kernel


Medals: 380
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2005-11-24 09:58:20 »

Just imagine how little work the GC will have to do when escape analysis gets into 6.0 Smiley Truly freed from the shackles of performance worries vs. design at last.

Cas Smiley

Offline Raghar

Junior Member




Ue ni taete 'ru hitomi ni kono mi wa dou utsuru


« Reply #8 - Posted 2005-11-24 20:52:19 »

Actually PDF is format created and maintained by Adobe, so it's not exactly crossplatform any more than PS or DJV, and it's incredibly hard to download on computer especially compared to HTML file (You don't have bandwidth limits on your site right? ~_^). Also it's kinda hard to read without viewer.
(Actually PS is harder to read, because I still didn't managed to add a nice PS reader on my computer.)
Offline Jeff

JGO Coder




Got any cats?


« Reply #9 - Posted 2005-11-25 22:39:08 »

Actually PDF is format created and maintained by Adobe, so it's not exactly crossplatform

UM I disagree. Adobe works very hard to keep readers availabe on just about every paltform knwon to man.  Ergo it may not be free but it is cross paltform.

As an aside tangential to the point, but not necc to your response, they also publish that standard in public.  I wrote a PDF viewer in Java years ago.  The only thing that prevented me from releasing it is that PDF uses LZW and at the time LZW was controlled by Univac.

Quote
and it's incredibly hard to download on computer especially compared to HTML file


How it harder then any other file?? Comapring it to HTMl isnt a very fair comparison because PDF is a complete page markup langugage.  HTMl is a highly limited rpesentation language.  Aditionally, PDF gives you exact control over how the end product looks on all viewers, HML does not.

Quote
(You don't have bandwidth limits on your site right? ~_^). Also it's kinda hard to read without viewer.


Viewer is free.  Go to Adobe's site and download.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Raghar

Junior Member




Ue ni taete 'ru hitomi ni kono mi wa dou utsuru


« Reply #10 - Posted 2005-11-26 18:48:03 »

Alas because of my neighbourds, I'm still on dial - up pay per minute. Going to adobe site and download something is completely ot of my fiscal posibilities. Not to mention the HD space on computer that I use for Internet connection is limited too much to alow instalation of Adobe reader.

HTML 64 KB  <<<  PDF 640 KB

Of course HTML has another helpful features, It's easirer for reading, and it alows better indexing and searching. (Not to mention the possibility to take an image file and by irphanviewer use a few filters to look at specific part of the image.)

Imposibility of reformating PDF files is also sometimes problematic. You know some documents were formated for printing, not for viewing on computer screen. In fact they are HARD to read because PDF hold formating so well.
cc


So summary.
                                                                                                                                                                                                [/tr]                                                                                                         
                                                                if                                                                                                   
                                                                   
PDF    HTML   simple TXT RTF
Ease of compresion    0.8     (1.25x) (majority at least 2.4x up to 5x)    2.2 up to 4.8    majority 2.4x
Proxy caching        x      yes                           yes            yes
Refurmating possibile  no         yes (by editor or by hand)        yes (easy)   need wordprocessor
indexing      by Adobe reader could be 30 min          yes standard F3 on windoze,  or MC, or by easy to write program    the same as HTML
size on disk for 10000 files    freekingly high 860KB - 120MB/file      manageable       easy          kinda easy
Could show intention of developer well yes                  yes          could       could +formated
error detection            yes      no                       no            just rarely yes
Other isues                too static                not careful could be too wide, pople are using bad tools to create HTML       x    badly readable by  notepad

Other       Adobe reader startup is 15-20 sec, it shows that ugly patent numbers on the startup. Incompatibilities between versions, and 2.5 hours between I could download PDF and look at it at my development computer.

This is short summary what I have against PDF.
Offline Jeff

JGO Coder




Got any cats?


« Reply #11 - Posted 2005-11-27 00:36:13 »

Alas because of my neighbourds, I'm still on dial - up pay per minute. Going to adobe site and download something is completely ot of my fiscal posibilities.

Um.  Its only 37MB.  Do you have a Starbucks in your area?  Go, get a cuip of cofee, and downlaod it on their wireless Cool.  Thats what Im doign on this laptop right now, takes abouit 2 min.

As for HD space... Staples just ahd a 200gig hard drive on sale for 20 bucks this weekend.   Thats 10 cents a gig.  Which means the space for reader is about 40 cents.

I'm sorry, I feel for you, but if your resourcesa re THAT far below what is standard on even cheap computers  today you really can't expect people to cater to it.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline K.I.L.E.R

Senior Member




Java games rock!


« Reply #12 - Posted 2005-11-27 03:10:35 »

Sorry but I insist that this thread should get back on topic.
I was actually LEARNING something before this thread went into HTML vs PDF.
Thanks.

PS: Andrew Davison I really loved your piece on the GC. I even had to show it to my friend.
It helped me understand the concepts behind the GC and how it should be used.

EDIT: Spelling.

Vorax:
Is there a name for a "redneck" programmer?

Jeff:
Unemployed. Wink
Offline Jeff

JGO Coder




Got any cats?


« Reply #13 - Posted 2005-11-27 03:59:52 »

Sorry but I insist that this thread should get back on topic.

Fair 'nuff.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Guillaume Denis

Innocent Bystander





« Reply #14 - Posted 2006-01-24 17:49:19 »

I've tried to tweak the garbage collection adjusting the parameters of heap size, new heap size, using parallel GC, etc. but my animations remain abrupt (I just use Java2D for some scrolling sprites). I have also noticed that the -XX:MaxGCPauseMillis doesn't seem to apply to full GC so, in my case, it's part of the problem.

Anyway thank you Andrew for the document, it has been a valuable help.
Guillaume
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.

Grunnt (20 views)
2014-09-23 14:38:19

radar3301 (14 views)
2014-09-21 23:33:17

BurntPizza (31 views)
2014-09-21 02:42:18

BurntPizza (22 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (29 views)
2014-09-20 20:14:06

BurntPizza (33 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (75 views)
2014-09-10 13:57:51

TehJavaDev (108 views)
2014-09-10 06:39:09
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!