2

Basically I have a django docker-container and I'm looking at memory usage through the docker stats. I'm using channels for websocket connections. When the first connection starts, memory usage goes from 60 to 65 mb. Throughout the connection memory slowly goes up. Then, when the connection stops it doesn't release any of the memory. I checked with del method and everything seems to be deleted.

Any idea how I could check why the memory is not being released? Or what could be making the memory stay occupied?

  • Unlike many other languages, Python does not necessarily release the memory back to the Operating System. Instead, it has a dedicated object allocator for objects smaller than 512 bytes, which keeps some chunks of already allocated memory for further use in the future. [source](https://rushter.com/blog/python-garbage-collector/#:~:text=faster%20Python%20programs.-,Memory%20management,back%20to%20the%20Operating%20System.&text=In%20some%20cases%2C%20all%20allocated,only%20when%20Python%20process%20terminates.) I think this is why del will not necessarily reduce memory. – forgetso Jul 06 '20 at 09:52

0 Answers0