[mercury-users] Stack overflow detection?

obo at ruk.cuni.cz obo at ruk.cuni.cz
Thu May 13 22:24:51 AEST 2004


Hi.

No need to hurry. For the moment, I identified one of the "dangerous
patterns" of input and I reject "dangerous sentences" before delving
any deeper.

In my case, the number of recursive predicates is quite limited, so the
predicate you suggest would be reasonable. (And I think it should appear
somewhere in the library, in the module require or such?) There is no need
for the compiler option yet.

Thanks a lot, O.

On Thu, 13 May 2004, Zoltan Somogyi wrote:
> > It is perfectly
> > correct to simply reject an input sentence on the basis of "memory
> > exhaustion", such a sentence is definitely not one of the "simple ones"
> > I'm selecting.
>
> Ah. In that case, a reasonably simple solution should be possible.
> How simple depends on whether your programs runs out of memory in a small
> set of simply predictable places, or not.
>
> If yes, I can write a predicate that checks if either stack is about to be
> exhausted, and throws an exception if the answer is yes. You would then call
> this predicate at starts of the recursive predicates that can run you out of
> stack, and catch any resulting exceptions.
>
> If the number of places where this call insertion would have to be done is too
> high, I could create a compiler option to insert this call at the start of all
> the predicates in the modules compiled with this option.
>
> I am writing this from Uppsala on a visit to the university here. My time
> here is limited, and I want to exploit it fully, so I won't be able to
> write the code you need until I get back to Melbourne next week.
>
> Zoltan.
> --------------------------------------------------------------------------
> mercury-users mailing list
> post:  mercury-users at cs.mu.oz.au
> administrative address: owner-mercury-users at cs.mu.oz.au
> unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
> subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
> --------------------------------------------------------------------------
>

--
Ondrej Bojar (mailto:obo at cuni.cz)
http://www.cuni.cz/~obo


--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list