Well, I don't know what's currently recursive and problematic, but
before making it iterative, one can try to make use of tail call
optimisation (using GOTO for loops if need be), or trampolines so as
to keep a constant stack.

P!

On 11 December 2013 04:22, Bram Moolenaar <[email protected]> wrote:
>
> John Little wrote:
>
>> On Wednesday, December 11, 2013 11:37:55 AM UTC+13, John Little wrote:
>>
>> > I'll make a debug build...
>>
>> Here's the last 12 lines of the backtrace:
>>
>> #174623 0x0000000000461591 in set_ref_in_item (tv=0x3945220, copyID=2)
>>     at eval.c:6974
>> #174624 0x00000000004614d9 in set_ref_in_list (l=0x2b89410, copyID=2)
>>     at eval.c:6942
>> #174625 0x0000000000461591 in set_ref_in_item (tv=0x2b9f040, copyID=2)
>>     at eval.c:6974
>> #174626 0x00000000004614d9 in set_ref_in_list (l=0x2b893b0, copyID=2)
>>     at eval.c:6942
>> #174627 0x0000000000461591 in set_ref_in_item (tv=0x26adc00, copyID=2)
>>     at eval.c:6974
>> #174628 0x000000000046149b in set_ref_in_ht (ht=0x8bb470 <globvardict+16>,
>>     copyID=2) at eval.c:6927
>> #174629 0x000000000046126a in garbage_collect () at eval.c:6805
>> #174630 0x00000000004cb51f in vgetc () at getchar.c:1562
>> #174631 0x00000000004cbaf6 in safe_vgetc () at getchar.c:1795
>> #174632 0x000000000051bb67 in normal_cmd (oap=0x7fff19a758c0, toplevel=1)
>>     at normal.c:666
>> #174633 0x0000000000620b5c in main_loop (cmdwin=0, noexmode=0) at main.c:1329
>> #174634 0x0000000000620468 in main (argc=1, argv=0x7fff19a75bc8) at 
>> main.c:1020
>>
>> Never had a backtrace 174,634 levels deep before.
>
> It appears to run out of stack space.  Not strange when going 100000
> levels deep.  Yep, valgrind confirms:
>
> ==20355== Stack overflow in thread 1: can't grow stack to 0xbe387fec
>
>
> The solution would be to make this iterative instead of recursive.
> Not so easy to do.
>
> --
> The users that I support would double-click on a landmine to find out
> what happens.                           -- A system administrator
>
>  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org        ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
>
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups 
> "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
Français, English, 日本語, 한국어

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui