Hi Philippe,
"set record off" solves the immediate issue. After 12000 games the memory usages is stable at the initial value about 247 MB.
-----Original Message-----
From: Philippe Michel <philippe.michel7@free.fr>
Sent: Tuesday, August 27, 2024 10:26 PM
To: Ian Shaw <Ian.Shaw@riverauto.co.uk>
Cc: bug-gnubg@gnu.org
Subject: Re: gnubg-cli crash
On Mon, Aug 26, 2024 at 08:47:39AM +0000, Ian Shaw wrote:
I'd been running a longish session of gnubg self-play when I got a crash. Is this a memory error?
gnubg 3-ply wins a gammon and 2 points.
The score (after 3428 games) is: gnubg 3-ply 2245, gnubg 0-ply 2183 (money session, without Jacoby rule).
Considering move...
(gnubg-cli:35568): GLib-ERROR **: 17:26:03.666:
../glib-2.74.5/glib/gmem.c:136: failed to allocate 699016 bytes
Yes, this is a memory allocation error. Gnubg uses the GLib memory allocation functions and, from their documentation: "If any call to allocate memory using functions g_new(), g_new0(), g_renew(), g_malloc(), g_malloc0(), g_malloc0_n(), g_realloc(), and g_realloc_n() fails, the application is terminated."
The idea is that it is difficult to recover cleanly from such a condition and modern computers have so much memory that it will never happen :-).
Running a 35 games session, my process (on linux but it shouldn't matter
much) goes from 230M to 257M, so at 3428 you may have used about 230 +
100 * 27, or 3 GB. gnubg-cli.exe being a "large address aware" 32bits executable, it should be able to use 4 GB of memory on a 64bits OS but less than this on a 32bits one (see https://urldefense.proofpoint.com/v2/url?u=https-3A__learn.microsoft.com_en-2Dus_windows_win32_memory_4-2Dgigabyte-2Dtuning&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=NIzIKF-gDHHkAFMi3cht7V4XuqIwZykq4ICAvAepvAo&m=iroh4KjxcqHjASFeE_4bcBo5AIKoY6D0O5QBK_fOJeGeX8evPpj6_TM6oBWEjXAe&s=nJ2kPo1VfqoEfIAQP20Mk8zejW30VMlZiEuKlR-DhRw&e=
for explanations).
Using about 500kB-1MB per game seems a bit high but not ridiculous (the evaluations of all legal moves in all positions are recorded). As far as I know there is no memory leak in the session recording but it may not be used as sparingly as it could.
As a practical matter, if you need to keep the games record you should probably restrain the sessions to, for instance, 2000 games and collate the results yourself if you need more of them.
If you don't need it you can use the "set record off" CLI command or uncheck "Settings/Options/Other/Record all games" in the GUI.