Lisp HUG Maillist Archive

Re: stack overflow with regular expressions

I tried compiling the pregexp library and also increased the stack size to 
64000.  This helped a little bit, but i'm still having problems with 
expressions matching certain character classes.

The knowledgebase mentions setting debugging off by  evaluating 
(hcl:toggle-source-debugging nil) and
setting the debug optimization level to 0.  I did the former, how do you do 
the later?

If this doesn't help, I will try one of the native lisp regexp libraries 
that someone mentioned.

>From: David Fox <davef@xanalys.com>
>Reply-To: David Fox <davef@xanalys.com>
>To: edi@agharta.de
>CC: ljw1001@hotmail.com, lisp-hug@xanalys.com
>Subject: Re: stack overflow with regular expressions
>Date: Tue, 1 Jul 2003 20:36:22 +0100
>
>    > When i try to use the pregexp regular expression library with
>    > Lispworks Personal Edition 4.2.0 for anything other than trivial
>    > matches, I get an error, either "Stack overflow (stack size 16000)"
>    > or "recursive stack overflow".  The same code works fine in CLISP.
>    >
>    > Can someone tell me:
>    > (1) whether or not i'm doing something wrong
>    > (2) if this is a limitation of Lispworks
>    > (3) if its a limitation of the personal edition
>    > (4) if there is anything I can do about it?
>
>    You might be able to extend the stack, see
>
>      
><http://www1.xanalys.com/support/lisp/kbase.nsf/51fe6e1cdfe748a180256639005a2ba9/f35acd8100dfd9ba8525670b0074a8d6?OpenDocument>
>
>    for an explanation. Don't know if this works with the Personal
>    Edition, though.
>
>Stack extension is the same in the Personal Edition as the
>Professional/Enterprise Editions.
>
>
>Dave Fox
>Xanalys
>Compass House
>Vision Park
>Chivers Way
>Histon
>Cambridge
>CB4 9AD
>England
>
>Email: davef@xanalys.com
>Tel:   +44 1223 253793
>Fax:   +44 1223 257812
>These opinions are not necessarily those of Xanalys.
>
>
>________________________________________________________________________
>This email has been scanned for all viruses by the MessageLabs Email
>Security System. For more information on a proactive email security
>service working around the clock, around the globe, visit
>http://www.messagelabs.com
>________________________________________________________________________

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus


Re: stack overflow with regular expressions

On Tuesday 01 July 2003 04:23 pm, Larry White wrote:
> setting the debug optimization level to 0.  I did the former, how do you do
> the later?

(declaim (optimize (debug 0)))

or

(proclaim '(optimize (debug 0)))

You could also add (space 3) to the above and see if that helps.  Check the 
compile messages (e.g. in the Output window) to see that the compiler really 
did use the option(s) you specified.

You could also browse the backtrace and see if any one routine appears 
frequently in the backtrace.  Look at the routine and see if you can't 
convert the recursion into a loop.  I've only hit stack overflows (16000) 
when I had honest bugs and once when I had an insanely recursive routine that 
could easily have been converted to a loop / dolist / whatever.

pt


Updated at: 2020-12-10 09:00 UTC