[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4586: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4588: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4589: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4590: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
AI Challenge Forums • View topic - Java garbage collection settings

It is currently Thu Jan 18, 2018 12:11 pm Advanced search

Java garbage collection settings

Topics about starter packages, visualizer or any other third party tools.
Please submit new language requests in the Language Request Forum.

Java garbage collection settings

Postby gvsmirnov » Thu Nov 03, 2011 11:20 pm

When I implemented a new algorithm for my bot, I came across a peculiar problem. The thing is that my algo requires some large amount of data stored in the memory, which changes considerably every turn and there is no obvious way to update it incrementally. So, the data becomes outdated once every turn starts, and is free to be garbage collected.

BUT, during the turn, while the data is stil relevant, a minor collection can occur, which could result in the data being placed in the tenured gen. And, well, if that's the case, on the next turn, the app can easily run out of free memory, start full GC and time out. It still holds true for the CMS collector, as it may not have enough time to free enough memory in the tenured gen (since the new data is generated faster that the old data is collected).

So, it would be really great if the java contestants were allowed to specify SOME (not all, obviously) options to the garbage collector, especially the distribution of memory among memory pools. In my case, the issue is easily solved by reducing the size for the tenured gen in favor of the eden space and the survivor space.

Another option is to clear all the references to the old data at the end of the turn, explicitly call System.gc() and, hoping that it would help, wait until either the memory seems to be freed or the turn is about to end, and only then send the 'go' line.

Anyways, the situation is more sad than amusing, as this is a great example of the .
gvsmirnov
Captain
 
Posts: 27
Joined: Thu Sep 09, 2010 8:13 pm

Re: Java garbage collection settings

Postby djstrong » Sun Dec 11, 2011 4:32 pm

Is there any good solution to timeouts because of GC in Java? I am stopping my bot when time remaining is less than 20ms, but one GC session can take more than 100ms (locally even 500ms) and I have also timeouts on server.
djstrong
Cadet
 
Posts: 5
Joined: Mon Dec 13, 2010 10:11 pm

Re: Java garbage collection settings

Postby katebus » Wed Dec 14, 2011 10:06 am

Do you really have so long garbage collection phases! 100 ms or even 500 ms. That is.. a big amount of data to clear. Right now I have a stupid bot that does simple Bredth First Search to find path for every single ant (most of the time it is not able to, because it has to finish before timeout) without any cache, and so far It has not timed out. Maybe you should look at your data structure, maybe there is something that makes it slow to create/remove (and maybe it is fast but just it is so big - like 1GB).

And remember that even people using C++ can have problems when allocating a big number of new objects every turn (it can take some time). And people with other tools/languages also have problems.

BTW: if you are using the starter package you should change a few things (ie. a parser creates many unneeded objects).

P.S. I have read your entry again, and I gree with you that it may be beneficial for us if we can at least set the distribution of memory pools.
katebus
Lieutenant
 
Posts: 10
Joined: Mon Sep 13, 2010 2:25 pm

Re: Java garbage collection settings

Postby djstrong » Thu Dec 15, 2011 11:04 pm

I have rewritten my bot to Java form Python couple days ago. The speed has improved more than 10 times.

It is poorly written and can allocate in one turn 300MB (and yes, I'm using default starter). Timeouts are very rarely and randomly. I tried even doing full GC every turn, but it doesn't help.

In comparison to C++, in Java you can't control GC and even some conditions to stop working when time is remaining will not help.
djstrong
Cadet
 
Posts: 5
Joined: Mon Dec 13, 2010 10:11 pm


Return to Starter Packages & Tools

Who is online

Users browsing this forum: No registered users and 0 guests

cron