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

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!


Comment on Re: one-liner hogs
Select or Download Code
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?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2015-12-02 05:01 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (34 votes), past polls