in reply to Re: Possibly silly perl memory allocation question, duplicating scalars
in thread Possibly silly perl memory allocation question, duplicating scalars

This is an interesting technique. I have a couple of questions though.

I'm not clear what the effect of the statement <STDIN> is after printf 'Check'? It waits for input but doesn't assign the input to anything. The docs don't talk about using <> without an assignment (except in a conditional). Would this be considered a void or boolean context? Your output shows some process info on the same line as check. Is that a side effect? Is that result OS specific? I get nothing back on my system (WinXP w/Activstate 5.6.1)?

Is the NULL value at the end of $bigScalar necessary as a perl internal or are you using it as an end of file marker for program control?

Just curious. Thanks for an interesting half hour.

PJ
use strict; use warnings; use diagnostics;
  • Comment on Re^2: Possibly silly perl memory allocation question, duplicating scalars

Replies are listed 'Best First'.
Re^3: Possibly silly perl memory allocation question, duplicating scalars
by BrowserUk (Patriarch) on Dec 15, 2004 at 14:52 UTC

    The <STDIN> is there purely to make the program stop and wait at that point while I 'Check' the memory consumption in the task manager. The void context simply means that whatever input is typed, it is simply discarded.

    The memory figures you see are just what I typed at that point so as to record that information as a part of teh console log. They are the "Memory usage" and "VM size" figures from the Task Manager Processes tab.

    The null byte I write could be any value. You just have to write something, after you do the seek, to cause the 'file' to be extended to that point. Just as would with a normal file.


    Examine what is said, not who speaks.        The end of an era!
    "But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
    "Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo         "Efficiency is intelligent laziness." -David Dunham
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
      OK, great. Thanks

      PJ
      use strict; use warnings; use diagnostics;