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

for open it is enough. for the 1G calculation ? can u pls explain further?

Replies are listed 'Best First'.
Re^5: how to occupy 1G of memory
by BrowserUk (Patriarch) on Jul 13, 2010 at 09:32 UTC

    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.
Re^5: how to occupy 1G of memory
by Anonymous Monk on Jul 13, 2010 at 09:18 UTC
    1024 raised to the 3rd power is 1GB