Closed eug3nix closed 3 years ago
Thank you for a very nice bug report. Could I ask you to try reducing the test case one step more to a smaller one that uses just Markup(...).join(...)
and perhaps uses gc.collect()
and len(gc.get_objects())
to check the reference count. There is quite a lot going on in your example (13 dependencies, a web server) and I couldn't see anything obviously wrong in 99ad51d.
Thank you for your feedback. Here is the adjusted test and the results I have got from it
$ pip list |grep Genshi && python ./test.py
Genshi 0.7.5
objcount before: 5053
RSS before: 8692
objcount after: 5054
RSS after: 294336
$ pip install Genshi==0.7.0
$ pip list |grep Genshi && python ./test.py
Genshi 0.7
objcount before: 4166
RSS before: 7988
objcount after: 4167
RSS after: 39784
Thanks! Fix created in #47.
Fix merged.
Hi.
We are using Genshi template engine in one of our projects. After we upgraded to the latest stable Genshi release (we were using version 0.7.0 before) we have noticed what seems to be a memory leak.
Here is a minimal application which shows that behavior. memleak.tar.gz
I was able to isolate the exact commit where this issue started to show up: https://github.com/edgewall/genshi/commit/99ad51d824025a6427a133eca9c6e8501923eaba
I am not sure what exactly causes the issue but the memory leak is gone if we either: A)remove _speedupds.so B)revert to a Genshi version before the commit mentioned above.
Here are the lisf of steps to reproduce the issue:
install the project dependencies and run the app
observe the process memory usage before the test
make requests to the sample app
check the memory usage again
Note: the memory usage is constantly growing with each subsequent run of the test
Environment details:
Sincerely, Eugene