Skip to content

Instantly share code, notes, and snippets.

@Byte-Forge-AI
Forked from rectalogic/botoleak.py
Created December 30, 2020 16:53
Show Gist options
  • Select an option

  • Save Byte-Forge-AI/6b9fd698f54fe2d36b5d2e85b2352edf to your computer and use it in GitHub Desktop.

Select an option

Save Byte-Forge-AI/6b9fd698f54fe2d36b5d2e85b2352edf 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