Asking this question roots from When Perl is not applicable which makes a war on blog perl site. ;) On the contrary to the author's opnion, I does belive perl can handle large data, but I'm more interested in how perl handle it. and did some tests:

env: Win XP, perl 5.12.3, 512M memory available: 350M C:\>perl -e "@a = (1..1_000_000_000_000);" Range iterator outside integer range at -e line 1. # of course! C:\>perl -e "@a = (1..1_000_000_000);" Out of memory! # fair enough ;) C:\>perl -e "@a = (1..9_000_000);" Terminating on signal SIGINT(2) #took too long time, and I have to ki +ll it :(

When I ran the third one, perl ocuupied almost 340M memory at first. after 3 or 4 secs, it seems realize there is no enough memory for applying, then the utilization decreses to about 60M and hang. :(

So How perl handle applying of large memory? seems perl would do some swap when memory is not enough, but it isn't productive. It there a better way to make perl smarter? (i'd rather perl tells me "out of memory" than long time waiting).

Any cents? </code>




I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction


In reply to how apply large memory with perl? by xiaoyafeng

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.