From yan.guiborat@caramail.com Thu Jan 31 11:46:37 2002
Received: from mail.caramail.com (mail.caramail.com [195.68.99.70])
	by swi.psy.uva.nl (8.11.6/8.11.2) with ESMTP id g0VAkbL13542
	for <prolog@swi.psy.uva.nl>; Thu, 31 Jan 2002 11:46:37 +0100 (MET)
Received: from caramail.com (www34.caramail.com [195.68.99.119])
	by mail.caramail.com (8.8.8/8.8.8) with SMTP id LAA26540
	for prolog@swi.psy.uva.nl; Thu, 31 Jan 2002 11:46:36 +0100 (MET)
Posted-Date: Thu, 31 Jan 2002 11:46:36 +0100 (MET)
From: Yan Guiborat <yan.guiborat@caramail.com>
To: prolog@swi.psy.uva.nl
Message-ID: <1012473996004645@caramail.com>
X-Mailer: Caramail - www.caramail.com
X-Originating-IP: [212.157.192.147]
Mime-Version: 1.0
Date: Thu, 31 Jan 2002 11:46:36 GMT+1
Content-Type: multipart/mixed; boundary="=_NextPart_Caramail_0046451012473996_ID"
Subject: [SWIPL] Querying PL from C, under Freebsd.

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--=_NextPart_Caramail_0046451012473996_ID
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Thanks for the fast response Jan,

Them it seems to be an odd beheaviour of my application.
I am making a really single call to PL_new_predicate, no 
looping. So I cannot explain the crash.
I will investigate the thing more deeply this evening, and 
see them, if there is information to bring to the group.

Br,
Yan.




> I am facing a problem that I really don't know how to 
solve 
> fast, may be one could help, it would be great thanks.
> I was calling PL from C, under freeBSD in a usual way 
> looking like this.
> 
> term_t a0;
> predicate_t p;
> qid_t q;
> 
> a0 =3D PL_new_term_ref();
> .....
> ....
> 
> when I tested my application, it stucks, and if I don't 
> stop it fast enougth, it makes my pager process complain 
> strongly, and them kill the app and core it.
> I found that the problem was coming from the term 
> allocation ( a0 =3D PL_new_term_ref() ), and when I checked 
> in SwiPL doc, I found this :
> "
> term_t PL_new_term_ref()
> Return a fresh reference to a term. The reference is 
> allocated on the local stack. Allocating a term-reference 
> may trigger a stack-shift on machines that cannot use 
> sparse-memory management for allocation the Prolog 
stacks. 
> The returned reference describes a variable. 
> "
> I though so that my freebsd (4.0) cannot use sparse 
memory 
> management...is there a way to solve this problem, or do 
I 
> have to implement a sparse memory management or forget 
> about working under BSD (very sad).

Even if you don't have sparce memory management, this 
should not be a
problem. When calling PL_new_term_ref() in a loop you 
should use
the *foreign_frame() functions to discard created term-
references,
but just a plain call should work nicely. Any possibility 
to repeat
this here, or is it dependent on a very odd situation?

Any machine worth mentioning these days should support 
enough of mmap()
to make mapped stacks work. Can you provide a login?

	Cheers --- Jan



_________________________________________________________
Le journal des abonn=E9s Caramail - http://www.carazine.com


--=_NextPart_Caramail_0046451012473996_ID--

