Beefy Boxes and Bandwidth Generously Provided by pair Networks httptech
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Possibly silly perl memory allocation question, duplicating scalars

by periapt (Hermit)
on Dec 15, 2004 at 14:37 UTC ( #415032=note: print w/ replies, xml ) Need Help??


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
Re^3: Possibly silly perl memory allocation question, duplicating scalars
by BrowserUk (Pope) 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;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://415032]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2014-04-18 00:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (460 votes), past polls