Memory leak
I have used a simple Django server for my application https://github.com/kolserdav/ana/tree/1f9d445926f9b565010667dbd0daa21fea6a1080/packages/translate .
Django urls.py file https://github.com/kolserdav/ana/blob/1f9d445926f9b565010667dbd0daa21fea6a1080/packages/translate/translate/urls.py#L1-L27
Django translate handler file https://github.com/kolserdav/ana/blob/1f9d445926f9b565010667dbd0daa21fea6a1080/packages/translate/translate/api/translate.py#L1-L16
My Translateclass https://github.com/kolserdav/ana/blob/1f9d445926f9b565010667dbd0daa21fea6a1080/packages/translate/translate/core/translate.py#L1-L41
After I start the server, I start repeating the same request with Curl:
curl -X POST -d '{"q": "test", "source":"en", "target":"ru"}' -H 'Content-Type: application/json' http://127.0.0.1:8000/translateIn another window, I open top with a filter by name python:
top | grep pythonAfter a certain number (depending on server resources) of repeated requests, I see that the "python" process consumes a significant amount of memory. This share of memory will now never be freed, even if you stop repeating requests. This memory consumption remains until the process is restarted:
77899 kol 20 0 7468592 3.0g 174108 S 1.3 19.0 0:37.09 python
77899 kol 20 0 7697984 3.1g 174108 S 45.5 20.1 0:38.46 python
77899 kol 20 0 8418944 3.7g 174108 S 60.8 23.8 0:40.29 python
77899 kol 20 0 7730640 3.4g 174108 S 38.5 21.9 0:41.45 python
77899 kol 20 0 8091136 3.6g 174108 S 62.5 23.3 0:43.33 python
77899 kol 20 0 8091136 3.6g 174108 S 3.3 23.3 0:43.43 python
77899 kol 20 0 8091136 3.6g 174108 S 3.0 23.3 0:43.52 python
77899 kol 20 0 8091136 3.6g 174108 S 3.3 23.3 0:43.62 python
77899 kol 20 0 8091136 3.6g 174108 S 1.3 23.3 0:43.66 python
77899 kol 20 0 8091136 3.6g 174108 S 1.7 23.3 0:43.71 python
77899 kol 20 0 8091136 3.6g 174108 S 2.3 23.3 0:43.78 python
77899 kol 20 0 8091136 3.6g 174108 S 3.0 23.3 0:43.87 python
77899 kol 20 0 8091136 3.6g 174108 S 2.3 23.3 0:43.97 python
77899 kol 20 0 8091136 3.6g 174108 S 2.0 23.3 0:44.03 python If you continue to make requests, then the process will soon crash with status 247
I will be grateful for any help.
Source: argosopentech/argos-translate