Skip to content

boto3 session client memory #3397

Discussion options

You must be logged in to vote

Thank you for your patience @romiLightlytics. Upon further investigation, I think the possible root cause of memory leak, in this case, could be multithreading where single session is being used by multiple thread. Here's the documentation that mentions multithreading:

Resource instances are not thread safe and should not be shared across threads or processes. These special classes contain additional meta data that cannot be shared. It's recommended to create a new Resource for each thread or process...

The idea is to create one session per thread. For your reference, I also found this code example from other user and they mentioned how it resolved the memory leak issue.

Hope it helps!

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@romiLightlytics
Comment options

Answer selected by tim-finnigan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants