Repository navigation
Conversation
|
Oof, I've done some more testing and it's trickier than I thought. The call to It seems like this may be difficult to solve, given that |
|
Hi, Thank for the PR. Fortunately we recently added an optional callback to libuast iterator's constructor to allow to pass a binding specific callback for things like increasing and decreasing refs (currently only the Scala client is using it). Adding it also to filter is also planned and should solve this problem. |
|
Nice! That's awesome to hear. I think the other DECREFs in the PR might be useful even with the callback, but I'm not 100% sure. Certainly the largest memory leak is solved by the callback. |
|
Found the leak. It's here: https://github.com/bblfsh/libuast/blob/master/src/uast.cc#L504 The CreateXMLNode function converts the children to XML nodes but never frees them (commenting out that the leaks goes away, even without the last DecRef commit). Currently searching for the best approach to fix it. |
|
@amlweems: Fixed it, it wasn't easy to track... there was another leak on the |
|
@amlweems PS: I can't add you to the reviewers box on the other PR because you're not added to the bblfsh project, but please feel free to review it. |
There are a few memory leaks in
pyuast.cwhen objects are owned by a function, used, and not returned. I've been doing some benchmarking and here's a comparison of memory usage / objects. I've also added a unit test which can be used to test for memory leaks in thefilterfunction (for now, it just considers memory usage doubling to be a leak).Note: these numbers are based on a patched libuast which fixes a different leak.
Before
After
Memory stats obtained via
pympler: