Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How can I make my program occupying a lot of memory (sic!)?

by BrowserUk (Pope)
on Nov 03, 2012 at 20:25 UTC ( #1002139=note: print w/replies, xml ) Need Help??


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...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002139]
help
Chatterbox?
[Corion]: Cosmic37: Basically, you read one file into a hash, keyed by your key, and then match the lines from the second file to that hash
[Cosmic37]: note that the two files only have datetimes which may match whereas other data per line is different format in file1 and file2 - is that really intersection?
[jedikaiti]: Hi Monks
[Corion]: Cosmic37: Well, if you want to use only parts of a line for the key, see split or whatever other mechanism to extract the key from the line
[Corion]: Hi jedikaiti!
[Cosmic37]: is there a webpage for full CB for this chat rather than side panel chat?
[Cosmic37]: thank you for advice
[Cosmic37]: peach greets jedi
[Cosmic37]: ok this one works better fullpage chat
[Cosmic37]: test

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2017-06-29 16:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (672 votes). Check out past polls.