in reply to how to occupy 1G of memory

Here's a simple and efficient way:

#! perl -slw use strict; my $ramfile; open RAM, '>', \$ramfile; seek RAM, 1024**3 - 1, 0; print RAM chr(0); close RAM; printf "Check ram: "; <>; undef $ramfile; printf "Check ram: "; <>; __END__ c:\test>GbRamFile.pl Check ram: 1056792k Check ram: 6168k

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

Replies are listed 'Best First'.
Re^2: how to occupy 1G of memory
by Anonymous Monk on Jul 13, 2010 at 06:12 UTC
    can u please explain this ?

    specifically, what is the file you open ? and what is that calculation ? ( how it is 1 GB )
      can u please explain this ?

      Was the other anonymonk's explanation enough?

        for open it is enough. for the 1G calculation ? can u pls explain further?
      Its special in-memory file handle, see perldoc -f open

      The calculation is the number 1GB