-
-
Save Byte-Forge-AI/6b9fd698f54fe2d36b5d2e85b2352edf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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