Fix memory leaks (thanks @amlweems)#75
Conversation
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
|
cc @amlweems |
vmarkovtsev
left a comment
There was a problem hiding this comment.
LGTM, but I recommend running the test suite under valgrind and CPython configured with --without-pymalloc --with-pydebug --with-valgrind just to make sure we have not missed anything.
|
Nice! Testing with I tried running with cpython and valgrind. I get a lot of "possibly lost", but no worrying "definitely lost". I'm not super confident in these results, but I am very happy with the object counts above. Full output attached. |
|
@vmarkovtsev that would be certainly great, I used a simpler tool that doesn't required Python to recompile called memleax, I'm pretty sure current leaks are fixed since I increased locally the iterations in the memory test to 100.000 and the memory didn't increase, but I'll give a run with Valgrind when I've a little time. On the other side, Travis is failing with a core dump while its working perfectly on my machine :/ |
|
@amlweems This leak summary gives a solid confidence that all the leaks are fixed, awesome! |
|
Found the reason why it works on my machine(TM) and not in Travis... when testing for leaks, I set the environment variable "PYTHONMALLOC" to "malloc" since that allows the |
|
Looks like the problem comes from mixing malloc with pymalloc in the same extension module. This is not a problem for shared libraries, but since libuast is compiled with the extension module it causes problems. The solutions I'm evaluating are requiring and using |
…lter() Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
|
Ok, the pointer-between-different-mallocs problem is hellish and using the |
|
Amazing detective work @juanjux ! |
(Branched from amlweems:fix-memory-leak)
Apply the memory leaks detected and fixed by @amlweems with an aditional one for the
Stringhelper functions that allows the fix forItemAtto work.Test (also from @amlweems branch) to check that memory doesn't increase after 100
filter()calls.Signed-off-by: Juanjo Alvarez juanjo@sourced.tech