Loading ...
Sorry, an error occurred while loading the content.

Re: VIM crashes in one extreme situation

Expand Messages
  • George V. Reilly
    ... Unbounded recursion is a really bad idea. (I assume that s the underlying problem.) Why not explicitly manage the recursion state on a custom stack,
    Message 1 of 19 , Mar 1, 2005
    • 0 Attachment
      Bram Moolenaar wrote:

      >The examples I found with this mechanism are around very simple code.
      >We do recursive function calls. That might be the reason it doesn't
      >work for Vim.
      >
      >If someone has good ideas how to make this work reliably, let's hear it!
      >Otherwise the only solution is to compile with MSVC.
      >
      >

      Unbounded recursion is a really bad idea. (I assume that's the
      underlying problem.) Why not explicitly manage the recursion state on a
      custom stack, instead of implicitly on the system stack?

      --
      George V. Reilly george@...
      America is the only nation in history which miraculously has gone
      directly from barbarism to degeneration without the usual interval
      of civilization.
      -- George Clemenceau (1841-1929)
      -- Oscar Wilde (1854-1900)
      (Get Witty Auto-Generated Signatures from http://SmartBee.org)
    • Bram Moolenaar
      ... We would still run out of stack. Or do you mean that we would know how large the stack is and we can check that it s almost full? We actually already
      Message 2 of 19 , Mar 1, 2005
      • 0 Attachment
        George Reilly wrote:

        > Bram Moolenaar wrote:
        >
        > >The examples I found with this mechanism are around very simple code.
        > >We do recursive function calls. That might be the reason it doesn't
        > >work for Vim.
        > >
        > >If someone has good ideas how to make this work reliably, let's hear it!
        > >Otherwise the only solution is to compile with MSVC.
        >
        > Unbounded recursion is a really bad idea. (I assume that's the
        > underlying problem.) Why not explicitly manage the recursion state on a
        > custom stack, instead of implicitly on the system stack?

        We would still run out of stack. Or do you mean that we would know how
        large the stack is and we can check that it's almost full? We actually
        already have code for that: mch_stackcheck(). But it can only be used
        if we know how big the stack is, therefore it's only used when
        getrlimit() is present.

        Thus if you know a way to figure out the size of the stack, we can use
        that solution.

        An ever better solution would be to change the regexp code from using
        recursive calls to a linear approach. But that means rewriting most of
        the complex regexp code...

        --
        GALAHAD: Camelot ...
        LAUNCELOT: Camelot ...
        GAWAIN: It's only a model.
        "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
      Your message has been successfully submitted and would be delivered to recipients shortly.