users-prolog
[Top][All Lists]
Advanced

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

Re: garbage collection


From: Fergus Henderson
Subject: Re: garbage collection
Date: Wed, 18 Feb 2004 11:11:13 +1100
User-agent: Mutt/1.4i

On 17-Feb-2004, Mike Maxwell <address@hidden> wrote:
> I need to port an app from "Visual Prolog" (I know, that's why I'm porting
> it).  One of the guidelines is that the source code needs to remain hidden,
> hence I want a true compiler.

Did you consider porting it to Mercury?

Visual Prolog is in many ways more similar to Mercury than to Prolog --
for example, both Visual Prolog and Mercury are strongly typed.
The Mercury implementation is a true compiler, supports garbage collection,
and is likely to be considerably more efficient than GNU Prolog.

> (1) Am I correct that Gnu Prolog doesn't have gc?

Yes.  Or at least that was correct last time I looked.

> (2) How much of a problem is this in practice?  What kind of programming
> constructs lead to running out of memory?

Loops written using tail recursion (as opposed to repeat-fail loops).

> (3) There's a snippet of code on page 85 of O'Keefe's "The Craft of Prolog"
> which claims to be a work-around for systems without gc.  But I'm unfamiliar
> with how Prologs work internally, and it's unclear to me whether this will
> necessarily work with GnuProlog.

That work-around should indeed work with GNU Prolog.
But depending on your application, it can be difficult to determine
the right places to put gc_call/1 calls, and the copying and dynamic call
overhead that gc_call/1 involves can degrade performance considerably.

-- 
Fergus Henderson <address@hidden>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.




reply via email to

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