Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!europa.eng.gtefsd.com!howland.reston.ans.net!EU.net!sun4nl!knowar!hlub
From: hlub@runner.knoware.nl (Hans Lub)
Subject: Memory problem with wamcc 2.2 on Linux 1.0
Sender: news@knoware.nl (News Account)
Message-ID: <hlub.782432880@dolomieten>
Date: Mon, 17 Oct 1994 22:28:00 GMT
Lines: 38
Nntp-Posting-Host: hlub.knoware.nl
Organization: Knoware Nederland
Keywords: wamcc linux C memory

For a little (?) project of mine - building a compiler/typechecker for
a functional language in Prolog - I need a Prolog with a good interface
to C.

I found Daniel Diaz' wamcc 2.2, a very nice Prolog -> C compiler; this
would seem to make a seamless integration with C code very easy.
Compiling it under Linux 1.0 was a breeze; though something may have
gone wrong (see question #2 below)

Before I bother the author with my questions, I try putting them here:

- The interface to C is indeed very straightforward; but there is a
number of macros to assist in this (accessing arguments, building
structured terms etc) which are not documented as far as I can see.
Does anyone have experience with/ documentation for this?

- wamcc compiled with only some innocent-looking compiler warnings
about converting pointers to int. However, the wamcc executable gobbles up
all my memory even for the simplest of programs: even the 'query' 

| ?- repeat,fail. 

eats up 2 Megs of memory every second; if I don't kill wamcc my machine
ends up almost frozen, pathetically chewing its swap file.
Compiling/interpreting makes no difference other than in speed of
memory leakage.  Other than this, wamcc seems to work flawlessly and
even if compiling is'nt fast (mainly because gcc is'nt), the compiled
code *is* fast.  
Before I fire up the debugger: Does anyone know how to port wamcc to
Linux without this memory problem? Did I overlook something obvious?



--
Hans Lub                                                +31 30-899249
Dolomieten 74   NL 3524 VH Utrecht                      hlub@knoware.nl
