[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: heap eaten?
- Subject: Re: heap eaten?
- From: td@almeria.inria.fr (Thierry Despeyroux)
- Date: 3 May 93 08:52:26 GMT
In article <45844@sophia.inria.fr>, brad@cs.adelaide.edu.au (Bradley Alexander) writes:
|>
|> Hello,
|> I have been attempting to use a trick mentioned on this
|> mailing list some time ago to save memory whilst using mu-prolog.
|> The trick is to wrap up memory-hungry premises to rules in
|> a call to prove the predicate save_mem() where save_mem is defined:
|>
|> save_mem(G) :- save_mem1(G).
|> save_mem(G) :- foo(G),retract(foo(G)).
|>
|> save_mem1(G) :- G,assert(foo(G)),!,fail.
|>
|> This trick works nicely.. it saves a lot of memory. Unfortunately
|> I sometimes get the message:
|>
|> heap eaten
|> ** sun4 : machine error : segmentation fault
|>
|> whilst executing the typol definition that uses save_mem().
|> It tends to happen when I use save_mem() frequently in the
|> definition.
|>
|> Is the heap size related to the options I run Centaur with or just
|> some space on the machine? The point at which centaur runs out of
|> heap seems to depend on my interpreter definition rather than the
|> machine I run it on. Is there a default heapsize?
MU-Prolog uses a single area for its execution stack and its heap. This
single area is known to Centaur users that use GSTKLEN to give its size.
The stack starts at one end, the heap starts at the other end. When they
meet together, this give "out of memory" or "heap eaten" or other error
messages and the consequences are not well handled in some cases.
save_mem saves memory in the stack, but as it uses assert/retract it
consumes some place in the heap. The game is to save more in the stack
that what is consumed in the heap. In your case may be it is not sufficient.
Thierry.
--
Send contributions and compliments to centaur@sophia.inria.fr. Registration
and administrative matters should be sent to centaur-request@sophia.inria.fr.
+---------------------------------------------------------------------------+
| Thierry Despeyroux | email: Thierry.Despeyroux@sophia.inria.fr |
| I.N.R.I.A. Sophia-Antipolis | phone: +33 93 65 77 07 fax: +33 93 65 77 66 |
+---------------------------------------------------------------------------+
- References:
- heap eaten?
- From: brad@cs.adelaide.edu.au (Bradley Alexander)