Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: one-liner hogs

by Trinary (Pilgrim)
on Feb 01, 2001 at 03:37 UTC ( #55600=note: print w/ replies, xml ) Need Help??


in reply to one-liner hogs

Very basic one:

perl -e 'while (++$i) { $foo[$i] = $i; }'
That'll chew memory like mad, and soon bomb out. CPU usage minimal.

of course, you can make it use CPU...

perl -e 'fork; fork; while (++$i) { $c .= crypt($i,$i); $c = substr($c +,4,128); }
Ctrl-C kills all children, no root required! Load should fly up to around 4, give it a minute or two. To add mem usage, change the substr length.

Fun request!

Trinary


Comment on Re: one-liner hogs
Select or Download Code
Re: Re: one-liner hogs
by premchai21 (Curate) on Feb 28, 2001 at 06:36 UTC
    My humble contribution: while (++$i) { $foo{$i}=[ @foo ]; $foo[$i]=[ %foo, $i ]; } bounces back and forth making new arrays of ever-increasing size. Allocated about 350MB in about 30 secs. Uses a lot of processor, though.

    Agreed. Quite fun deliberately pessimizing code.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://55600]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2015-07-05 04:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls