in reply to Re^4: Windows Non-Paged Pool Memory Allocation
in thread Windows Non-Paged Pool Memory Allocation

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.