in reply to How can I make my program occupying a lot of memory (sic!)?

it would lead to elseone 1G of memory occupied.

??

Could anyone tell me either how to make a program occupy a lot of memory

Easy:

my $mem = chr(0); $mem x= 1024**3; ## 1 GiB.
or answer a question: How much resources would be occupied totally if I run following code from a program that occupies, say, 1G of memory itself? ]

Try it :)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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 Neil Armstrong

Replies are listed 'Best First'.
Re^2: How can I make my program occupying a lot of memory (sic!)?
by Doctrin (Beadle) on Nov 03, 2012 at 20:49 UTC
    Hmm, no, I've made a mistake. It uses an extra 1 GiB as free -m says. Anyways, thanks for the code :) Now I know that I cannot execute fork()-s from heavy programs.
      It uses an extra 1 GiB as free -m says.

      I don't use *nix, but I think that the tool you are using is giving you bad info.

      AFAIK: That memory will not be cloned unless the forked child accesses it.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      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 Neil Armstrong

Re^2: How can I make my program occupying a lot of memory (sic!)?
by Doctrin (Beadle) on Nov 03, 2012 at 20:38 UTC
    Thanks a lot! This is what I've needed. I tried to launch your code, then fork, and it didn't take much more memory. I just thought that fork() call would duplicate the memory related to the parent process, but it didn't as it seems...