In adding a feature to some of my code, I accidentally (although not entirely surprisingly) managed to create infinite recursion in it. It had the oddest diagnostic message, and it got me wonder, what the heck type of "strange benchmark program" would actually be recursing 100 times? And those who would actually do such things, do they need to be explicitly mentioned here since they probably are way more advanced than I am?

$ nice perl -we 'use strict; use diagnostics; sub foo { foo() } foo()' Deep recursion on subroutine "main::foo" at -e line 1 (#1) (W recursion) This subroutine has called itself (directly or indir +ectly) 100 times more than it has returned. This probably indicates an infinite recursion, unless you're writing strange benchmark progra +ms, in which case it indicates something else.

Note to those crazy enough to run programs listed here without understanding their full implications: Without the "use diagnostics" and the warnings (probably more the latter than the former), this thing can do wierd and wonderful things. It took me about 10 minutes to regain control of my machine just running "perl -e 'sub foo { foo() } foo()'". Don't do that. On my next try, as you saw above, I threw in everything I could to keep it from repeating the behaviour. It did, however, seem to take up huge amounts of RAM, such that I have half my RAM available again, although my swap usage grew by about the same amount...


In reply to Strange benchmark programs? by Tanktalus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.