Hmm. Rather harder than you think apparently.

All that code does is cause a large amount of ram to be allocated to the process--and in an unnecessarially convoluted way.

If you want to grab a large chunk of ram, a simple @a = 1..1e8; does fine. The only problem with that is you are not sure exactly how much you are allocating.

To control exactly how much you cause to be allocated, the simplest way I've found is:

c:\test>p1 Perl> open RAM, '+<', \$ram; seek RAM, 1e9, 0; print RAM 'X'; print length $ram;; 1000000002 Perl>

which will allocate 956.1 MB of uninitialise ram.

However, if you look in the Task Manager in the "Kernel memory" box on the Performance tab, you'll see that the Nonpaged memory allocation is well under that number (just 14 MB on my system currently, with the script above still running). Memory allocated by Perl is not allocated from the non-paged memory pool.

Non-paged memory is a scarce resource that is usually allocated in small numbers of single pages by device drivers.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^5: Windows Non-Paged Pool Memory Allocation by BrowserUk
in thread Windows Non-Paged Pool Memory Allocation by Anonymous Monk

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.