Re: Prolog, memory management and memory leaks



On Tue, 29 Jan 2008 07:46:24 -0600
A.L. <alewando@xxxxxxxxxxxx> wrote:

On Tue, 29 Jan 2008 04:12:54 -0800 (PST), Mats <matsc@xxxxxxx> wrote:

O

In my experience, a more difficult kind of "memory leak" is memory
fragmentation. Many Prolog implementations manage their own memory;
others rely on malloc & free or similar. In both cases, memory can
easily become fragmented when the process has run for a long while,
filling the memory with blocks that are too small to be useful. Some
memory managers (SICStus's for example) coalesce adjacent free blocks
as far as possible, but I'm not aware of any Prolog that move blocks
around and completely defragment memory, which would be extremely
complex, what with all the necessary relocation and everything. The
only safe cure I know of is to restart the process.
--Mats

Agree. I had this problem with this early application, although not
necessary created by Prolog. Prolog was crashing because lack of
memory, despite enough memory was available, but fragmentation was
done by Java. Objects created using JNI are "pinned" - they cannot be
moved by GC and memory gets fragmented. Because of this, Java was
crashing as frequently as Prolog.

Current application doesn't run in continuous mode like the old one -
our ambition is to complete single session without restart. However,
if it is not possible, we will restart server in the middle of the
process.

A.L.

I've found that run to completion/restart is more reliable for most
environments, not just Prolog.

Dhu





.



Relevant Pages

  • Re: Prolog, memory management and memory leaks
    ... There was a myth than languages with garbage collector are free of ... I have Prolog application that is implemented as a "running forever ... predicate is executed that solves constraint problem. ... In some circumstances, this server leaks memory. ...
    (comp.lang.prolog)
  • Re: A few questions about Prolog...
    ... few Prolog implementations, and would appreciate if the community ... SWI-Prolog uses a lot of memory for stacks? ... unexpected is behavior of your program caused by programming error. ...
    (comp.lang.prolog)
  • Re: Prolog, memory management and memory leaks
    ... a more difficult kind of "memory leak" is memory ... Many Prolog implementations manage their own memory; ... memory, despite enough memory was available, but fragmentation was ... our ambition is to complete single session without restart. ...
    (comp.lang.prolog)
  • Re: A few questions about Prolog...
    ... few Prolog implementations, and would appreciate if the community ... SWI-Prolog uses a lot of memory for stacks? ... could find in favor of GNU-Prolog is a good choice of GUI. ...
    (comp.lang.prolog)
  • Re: Prolog, memory management and memory leaks
    ... fragmentation. ... Many Prolog implementations manage their own memory; ... One does need to be careful with dynamic code, records and atoms ...
    (comp.lang.prolog)