summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbox.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/dbox.c b/dbox.c
index 955d8b1..9cf8c96 100644
--- a/dbox.c
+++ b/dbox.c
@@ -851,6 +851,9 @@ static void SubSolve(const level_t *p_level, state_t *p_state, int p_depth,
state_t *s;
int ok;
int f;
+ unsigned long long cache_size;
+ unsigned long long max_cache;
+ int warned;
if (p_depth >= p_max_depth)
{
@@ -884,6 +887,16 @@ static void SubSolve(const level_t *p_level, state_t *p_state, int p_depth,
first = NULL;
curr = NULL;
+ cache_size = g_cached_states;
+ max_cache = cache_size * 4;
+
+ if (max_cache < cache_size)
+ {
+ max_cache = 0xffffffffffffffffllu;
+ }
+
+ warned = FALSE;
+
while(s)
{
/* Check to see whether the level is solved
@@ -970,6 +983,19 @@ static void SubSolve(const level_t *p_level, state_t *p_state, int p_depth,
SetChain(&first, &curr, new);
s = s->next;
+
+ if (g_cached_states < cache_size)
+ {
+ printf("WARNING: number of cached states has wrapped\n");
+ cache_size = g_cached_states;
+ }
+
+ if (!warned && g_cached_states > max_cache)
+ {
+ printf("WARNING: got over four times the number of "
+ "cached states at one depeth...\n");
+ warned = TRUE;
+ }
}
if (first)