[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GLOBALSZ leak issue?

From: emacstheviking
Subject: GLOBALSZ leak issue?
Date: Thu, 6 Aug 2015 18:18:07 +0100

I downloaded and built a fresh binary from here:

git:// master

I then loaded this code:

gtest :-

It looks like it would run forever as the values didn't change.

Then I ran this code:

gtest :-
    statistics(global_stack, GS),

Fatal Error: trail stack overflow (size: 16384 Kb, reached: 16384 Kb, environment variable used: TRAILSZ)

TRAILSZ is used for, AIUI, "variable bindings to undo", so that's understandable;  I am creating GS on each pass and then calling myself so it's stashing the current value of GS jut in case we ever came back.

gtest :-
    statistics(global_stack, _),

This still causes TRAILSZ to exhaust, which I expected because it is still a binding that has to be stashed I guess.


gtest :-
        statistics(global_stack, _),

Same again, TRAILSZ exhausted. From my obviously incorrect understanding of prolog, only fail/0 would cause any memory allocation to be released at this point?

SO... how does one use tail-recursion to keep an application running without running out of stack space? This really feels like "worrying about consing" when you first learn Lisp. Ultimately, unless you are out for performance the runtime will do it for you etc. BUT for Prolog, which is still new to me, I am now completely at a loss as to how to proceed.

Paulo, we've spoken briefly in the past and I keep meaning to use LogTalk but would that allow me to use my custom "gprolog" binary with my SDL extensions? It ought to I guess.

Firstly, I will try Lindsey-s advice and better my understanding of DCG productions as state transformers but I can't help feeling a little bemused and stuck at the moment as I have failed so far to understand the nature of the problem i.e. why is it apparently so  hard to be able to use gprolog for a long-running application?

Many thanks chaps for your time so far!

All the best,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]