Ludii Forum
Block - Printable Version

+- Ludii Forum (
+-- Forum: Problems (
+--- Forum: Game Problems (
+--- Thread: Block (/showthread.php?tid=390)

Pages: 1 2

Block - slimy_asparagus - 01-25-2021

I have not been able to load "Block" . I just get these errors:

Compiled Block successfully.
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
    at features.features.Feature.instantiateFeature(
    at features.FeatureSet.instantiateFeatures(
    at policies.softmax.SoftmaxPolicy.initAI(
    at policies.softmax.SoftmaxFromMetadata.initAI(
    at search.mcts.MCTS.initAI(
    at utils.LudiiAI.initAI(
    at util.AI.initIfNeeded(
    at app.loading.GameLoading.loadGameFromName(
    at app.loading.TrialLoading.loadTrial(
    at app.loading.TrialLoading.loadStartTrial(
    at app.DesktopApp.loadInitialGame(
    at app.DesktopApp.createFrame(
    at app.DesktopApp$
    at java.desktop/java.awt.event.InvocationEvent.dispatch(
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(
    at java.desktop/java.awt.EventQueue$
    at java.desktop/java.awt.EventQueue$
    at java.base/ Method)
    at java.base/$JavaSecurityAccessImpl.doIntersectionPrivilege(
    at java.desktop/java.awt.EventQueue.dispatchEvent(
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(
    at java.desktop/
If I delete preferences file, then it loads Surakarta just fine.

RE: Block - DennisSoemers - 01-25-2021

It's running out of memory because our Biased MCTS AI (which is the best AI we have so far in this game, and is hence also used if you select "Ludii AI" as the AI for one or both players) apparently needs quite a bit of memory in this game -- more than your Java process has available. On my machine it works fine, but the process does use close to 2600MB, which is quite a bit more than most games.

Until we get around to fixing it, there are 2 quick solutions you can use:

1) Just make sure to set the AI for both players in the dropdown menu to something other than Ludii AI or Biased MCTS. The game itself should load fine, it's just these AIs that require a lot more memory on this game
2) Launch Ludii.jar from the command line, using the -Xmx VM argument to increase the memory available to the application. Only do this if your computer actually has enough RAM available. For example, you could run the application using something like: "java -jar Ludii.jar -Xmx3G" (this would give 3GB of memory to the application, which should *probably* be enough -- you can increase if your hardware allows)

RE: Block - slimy_asparagus - 01-26-2021


Thanks for the response. I tried Human/Random and I got much the same result. In fact I ended up having to "kill -9" the Java process.

RE: Block - DennisSoemers - 01-26-2021

Huh that's surprising. Did you try increasing the heap size with something like -Xmx3G? By how much? How much RAM does your computer have? Do you have any indication of how much memory the process was using?

If you like, you could run it again with the extra "-XX:+HeapDumpOnOutOfMemoryError" command-line argument. So, something like: "java -jar Ludii.jar -Xmx3G -XX:+HeapDumpOnOutOfMemoryError". If it crashes with an OutOfMemory error, this should create a dump of all the memory contents of the process, I think simply in the same directory that you're running the command from. If you then find a way to upload it somewhere and provide me with a download link, I can inspect the contents. I can't imagine there would be any sensitive data in such a file, but if you prefer, you can also just privately send me such a download link at

RE: Block - slimy_asparagus - 01-26-2021

If I am understanding /proc/meminfo correctly I am not sure I terribly fancy increasing Ludii's memory usage:

MemTotal:        1917400 kB
MemFree:          100940 kB
MemAvailable:     168688 kB
Buffers:           18256 kB
Cached:           249208 kB
SwapCached:        42076 kB
Active:          1145364 kB
Inactive:         473760 kB
Active(anon):    1043388 kB
Inactive(anon):   397920 kB
Active(file):     101976 kB
Inactive(file):    75840 kB
Unevictable:          96 kB
Mlocked:              96 kB
SwapTotal:       1972220 kB
SwapFree:         207200 kB
Dirty:              5916 kB
Writeback:             0 kB
AnonPages:       1310128 kB
Mapped:           210156 kB
Shmem:             89544 kB
Slab:             112844 kB
SReclaimable:      41976 kB

I have the file here: . I will want to delete this as soon as possible as it is quite big.

RE: Block - DennisSoemers - 01-26-2021

Ok I see. Our current implementation for "boardless" games is not yet very well-optimised in terms of memory, especially for games that also involve Dominoes or other pieces that occupy more than a single position. Since your hardware indeed has a relatively low amount of RAM, I don't see a way in which you can load them properly until we get around to implementing significant optimisations for these games.

RE: Block - xenos1984 - 01-26-2021

Impressive. I just tried Block with two Ludii AI (Biased MCTS) players. I gave it 16GB for a try, and it used more than 8GB. After five dominoes have been played, both players pass and the game ends. Apparently there are two problems, comparing this behavior with the rules: 1. they do not take dominoes from the bag (Is the bag even defined anywhere?), 2. the game ends in a draw (as a consequence). Should they continue drawing dominoes until the bag is empty or one can be played?

I attached a trial.

RE: Block - Eric Piette - 01-27-2021


I found many problems in Block yes ;)
I think I fixed all of them now.
That will be in the next release (probably this afternoon/evening).


RE: Block - xenos1984 - 01-27-2021

Hi Eric,

that looks better indeed! Now it plays as I would have expected. Also I noticed that the Ludii AI now shows UCT instead of Biased MCTS, and that the memory consumption is a bit lower (it starts from 2.5GB after loading, and grows to 6.5GB during play.


RE: Block - DennisSoemers - 01-27-2021

How do you make it grow to 6.5GB? I've just watched two UCTs with 1 sec per move playing a bunch of games and it didn't really grow much beyond 2.5GB, definitely not quickly if at all. Though I guess it may be possible that, if you decide to give it a huge heap size upfront through the VM args, the garbage collector may simply not bother to clean up anything. If you give the process significantly less than 16GB or 8GB or 6.5GB or whatever you're giving it, and run the same experiment, I hope that it will actually clean up and not crash?