Skip to content

Memory leak eridication#73

Merged
eht16 merged 1 commit intoeht16:masterfrom
PMazarovich:queue_optimisation
Apr 16, 2022
Merged

Memory leak eridication#73
eht16 merged 1 commit intoeht16:masterfrom
PMazarovich:queue_optimisation

Conversation

@PMazarovich
Copy link
Contributor

@PMazarovich PMazarovich commented Apr 6, 2022

We faced with steady increasing of RAM consumption in AWS ECS and this began to happen after adding python-logstash-async library.
There is a known issue about Queue memory leak: https://bugs.python.org/issue43911
The simplest way to get rid of it - change Queue to PriorityQueue

@eht16
Copy link
Owner

eht16 commented Apr 10, 2022

Nice, thank you!

Did you test that the memory consumption is lower by using PriorityQueue or do you only assume it?

I'm still testing it with and without to compare the memory consumption of both variants.

@PMazarovich
Copy link
Contributor Author

@eht16 , yes, here is 2 graphics, 1 one is Queue, second one - PriorityQueue
Tested with this simple code

def pr():
    for x in range(0, 1000000):
        queue.put("message, message, message, message, message, message, message, message, message")
    while not queue.empty():
        queue.get()
    print(queue.qsize())
pr()

1
2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants