Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (489)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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  
  Blogpost about the garbage collector and GPU resources  (Read 596 times)
0 Members and 1 Guest are viewing this topic.
Offline tduindam

Senior Newbie





« Posted 2013-11-12 12:51:04 »

Hi all,

I just wrote a small blogpost about using the garbage collector for objects that have allocated GPU resources.

You can read it here: http://goo.gl/izYWng

I hope you find it interesting, and I'm curious to hear about other strategies that I could employ.

Cheers!
Offline StrideColossus
« Reply #1 - Posted 2013-11-12 14:41:39 »

Nice summary of the perils of the garbage collector Wink

I have a similar solution using weak references to GPU resources, but as you highlight there is no guarantee the GC will ever clean them up.  Unfortunately you still have manage those resources yourself, the focus of the code is purely on detecting orphaned VBOs, textures, etc. as a diagnostic, either periodically or as a dump when the app is closed down.
Offline tduindam

Senior Newbie





« Reply #2 - Posted 2013-11-13 15:21:17 »

Thanks :-).

Using this mechanism for keeping track of which objects aren't destroyed is a clever trick, maybe I'll add it to our engine.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #3 - Posted 2013-11-13 16:05:29 »

Hi

Quote
The only guarantee the JRE makes on this matter is that this will happen before Java runs out of heap-space
I already mentioned that several times here and on Ardor3D's forum, it's up to you to manage the native memory, you can run out of memory on the native heap if there is still enough memory on the Java heap. I quoted a documentation of IBM about that several months ago.

Quote
I solved the problem by explicitly removing buffers that I know are no longer required from the GPU
I have done the same in TUER about a month, I call glDeleteBuffers and I release the native memory of the direct NIO buffer.

Quote
you shouldn’t try to to be too smart around resources allocated out of sight of the garbage collector
Actually, you can't be smart, you have to track those resources by yourself.

Offline tduindam

Senior Newbie





« Reply #4 - Posted 2013-11-13 18:08:14 »

I did see that post you mentioned, but I forgot all about it. A pity, for it would have saved me some time :-)

Minor difference is that I ran into problems with GPU memory instead of native buffers, but the cause is exactly the same. I was wondering if I should post on the Ardor forum to alert people about the problem, but now I see that you have already done so.
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.

TehJavaDev (18 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (70 views)
2014-08-11 02:49:23

BurntPizza (47 views)
2014-08-09 21:09:32

BurntPizza (37 views)
2014-08-08 02:01:56
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!