Sponsored Content
Full Discussion: Is it a joke or a command?
Top Forums UNIX for Beginners Questions & Answers Is it a joke or a command? Post 303034672 by wisecracker on Thursday 2nd of May 2019 05:33:54 AM
Old 05-02-2019
Hi fellas...

OO oriented programming lends itself to quick acting fork_bombing and memory eating.
Take this Python code deliberately held back:
Code:
# Works on any Python!
# OO programming eats memory like there's in no tomorrow!
text='Junk variable!'
for x in range(0,5,1):
    text=text+text
    print(text)
    print(id(text))

# A very basic fork bomb for Python, the print function holds it back:
# def _(): _()

def _(): print('_()'); print(id(_))
_()

Results OSX 10.14.3, default bash terminal calling Python 3.5.2.
Code:
Last login: Thu May  2 10:13:33 on ttys000
AMIGA:amiga~> cd Desktop/Code/Python
AMIGA:amiga~/Desktop/Code/Python> python3.5 OO_bomb.py
Junk variable! Junk variable! 
4328391264
Junk variable! Junk variable! Junk variable! Junk variable! 
4328477280
Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! 
4327568992
Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! 
4338181032
Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! Junk variable! 
4337054352
_()
4338198864
AMIGA:amiga~/Desktop/Code/Python> _

As one can see the fork bomb although not obfuscated is a single line of code and very dangerous.
Object Orientation OTOH is memory hungry and anyone with any knowledge can do that from Python interactive shell.
With only 2MB of memory on a stock AMIGA A1200 and Python this stood out only too well as soon my 2MB was gone.
These 2 Users Gave Thanks to wisecracker For This Post:
 

We Also Found This Discussion For You

1. What is on Your Mind?

Post Your Favorite Joke! Laugh a Little!

Let's have a few laughs! Post your favorite joke! (no racist / racism jokes, please post in good taste, thanks!) (65 Replies)
Discussion started by: Neo
65 Replies
GUPNP_SERVICE_NOTIFY(3) 						 1						   GUPNP_SERVICE_NOTIFY(3)

gupnp_service_notify - Notifies listening clients

SYNOPSIS
bool gupnp_service_notify (resource $service, string $name, int $type, mixed $value) DESCRIPTION
Notifies listening clients that the property have changed to the specified values. PARAMETERS
o $service - A service identifier. o $name - The name of the variable. o $type - The type of the variable. Type can be one of the following values: o GUPNP_TYPE_BOOLEAN - Type of the variable is boolean. o GUPNP_TYPE_INT - Type of the variable is integer. o GUPNP_TYPE_LONG - Type of the variable is long. o GUPNP_TYPE_DOUBLE - Type of the variable is double. o GUPNP_TYPE_FLOAT - Type of the variable is float. o GUPNP_TYPE_STRING - Type of the variable is string. o $value - The value of the variable. RETURN VALUES
Returns TRUE on success or FALSE on failure. ERRORS
/EXCEPTIONS Issues E_WARNING with either not correctly defined type of the variable or the value is not corresponding to the defined type. SEE ALSO
gupnp_service_freeze_notify(3), gupnp_service_thaw_notify(3). PHP Documentation Group GUPNP_SERVICE_NOTIFY(3)
All times are GMT -4. The time now is 07:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy