Skip to content

Instantly share code, notes, and snippets.

@rectalogic
Last active December 30, 2020 16:53
Show Gist options
  • Save rectalogic/689e3254eba3aef3290905f17c477f3b to your computer and use it in GitHub Desktop.
Save rectalogic/689e3254eba3aef3290905f17c477f3b to your computer and use it in GitHub Desktop.
import gc
from threading import Thread
import boto3
import botocore
def client():
boto3.Session().client("s3")
while True:
threads = [Thread(target=client) for i in range(10)]
def start(t):
t.daemon = True
t.start()
map(start, threads)
map(lambda t: t.join(), threads)
# gc.collect()
print len([o for o in gc.get_objects() if isinstance(o, botocore.client.BaseClient)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment