in reply to Re^2: how to occupy 1G of memory
in thread how to occupy 1G of memory

can u please explain this ?

Was the other anonymonk's explanation enough?

Replies are listed 'Best First'.
Re^4: how to occupy 1G of memory
by Anonymous Monk on Jul 13, 2010 at 09:16 UTC
    for open it is enough. for the 1G calculation ? can u pls explain further?

      Hm. My anonymous secretary appears to have beaten me to it again, but

      1k (1024) * 1k = 1M; 1M *1k = 1G.

      The -1 seeks to a position just before the end of 1GB. The printchr(0); forces the allocation of the memory as a single large chunk that will be returned to the OS on release.


      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.
      1024 raised to the 3rd power is 1GB