Home MadLab   Info Memory
Memory

When solving problems, MadLab allocates memory dynamically. Since MadLab uses a "best first" approach, parts of the search tree has to be kept in memory. In most cases (including analyzing whole games) this is not a problem, but for harder problems memory may be an issue.

An indication that MadLab is running low on memory is if the search speed slows down (positions seen per second: the "kN/s" field above the board). This is because the program spends more and more time freeing memory (memory recycling, also called garbage-collection). When MadLab finally runs completely out of memory, a window should pop up and inform you of this, and what to do.

The popup window tells you how many MB of RAM the program is using. If you know that your system has more RAM than that, you may want to augment the amount of memory allocated for MadLab (the default setting is 64 MB which is rather modest for most modern pc's). See the last section of this page about how to to that (this is a bit technical to do).

Limiting the max number of positions allowed in memory

Another way of dealing with the memory issue is to put a limit on how many positions MadLab is allowed to store in memory. This parameter is easy to change, but you should note that reducing it comes at a cost: the problem will take longer to solve.

To set the maximum number of positions stored in memory, see the menu "Options" --> "Memory & search options". In the first field you can set the number of positions (which is set to "no limit" as default). Ideally, this parameter should be set as high as possible without running out of memory. So if you still run out of memory after setting some limit, you should try to lower the limit and run the problem again.

Adjusting system memory settings (RAM)

MadLab uses Java, and Java is configured to use up to a fixed amount of memory. The default setting used in MadLab is 64 MB, but you may may augment the amount allocated to MadLab by editing a configuration file in one of the MadLab folders.

  1. Find the JExpress folder in the folder where MadLab is installed (to locate the latter, see the menu "Help" --> "About MadLab..."). In this folder you will find a .properties file.
  2. Use a plain text editor (like the Windows Notepad) to open the .properties file. Be sure that you can save with the same name, and in plain text. Styled text as is common in word processing applications will not work.
  3. The memory allocation in MB is embedded in the string -Xmx64m. To set the maximum allowed memory to, say, 512 MB, change this text to -Xmx512m. Remember the leading "-" and the trailing "m" (for megabytes)!
  4. Save the file with the same name (remember, plain text only), and restart MadLab with this augmented memory allocation. If you open the menu "Help" --> "About MadLab...", you should be able to see that MadLab has been given more memory (see the "Java memory limit (max)" line).

On a Windows system, the above means changing the following line in the .properties file:

args==-Xmx64m -cp .;madlab.jar Xxx

to:

args=-Xmx512m -cp .;madlab.jar Xxx

If your system starts "swapping"/"paging" (slowing down because of extensive use of the hard disk) the parameter may be set too high. If you reduce the parameter (to correspond better to your actual RAM size), you will run out of memory more graciously.

On a 32-bit Windows XP, the upper limit of this parameter seems to be around 1.2 GB = 1200 MB (corresponding to -Xmx1200m). If you set it higher, MadLab may not start at all.