Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: one-liner hogs

by Trinary (Pilgrim)
on Feb 01, 2001 at 03:37 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://55600]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-25 12:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found