I've done some poking around with Valgrind and I've found two things:
1.) There was a trivial leak of list objects.
2.) Facts were being leaked in two places.
Using this memory_leak.py file attached to this bug I see a pretty dramatic improvement. At this point the extension module doesn't seem to have any significant leaks, although I think that the wrapper is leaking function and tuple objects.
Unfortunately this patch makes several operations much, much slower, namely clips.Clear(), clips.Reset(), and clips.Run(). I haven't looked into why this is.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Do you also have some debugger output? You said you use valgrind, for instance.
In order to look for specific leaks it could be useful for me to see if the leaks are in the CLIPS part or the wrapper (for instance: unreleased Python objects); I tried to automate most operations when it's about accessing lists of CLIPS objects (facts and rules for instance) from the wrapper, in order to avoid trivial errors. The operations you report didn't show leaks in the wrapper when I tested the list-retrieval routine in the wrapper, but as CLIPS is compiled along with the wrapper, maybe I can discover whether something happens in the CLIPS core.
Thank you,
F.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Example
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
https://gist.github.com/4626966
I've done some poking around with Valgrind and I've found two things:
1.) There was a trivial leak of list objects.
2.) Facts were being leaked in two places.
Using this memory_leak.py file attached to this bug I see a pretty dramatic improvement. At this point the extension module doesn't seem to have any significant leaks, although I think that the wrapper is leaking function and tuple objects.
Unfortunately this patch makes several operations much, much slower, namely clips.Clear(), clips.Reset(), and clips.Run(). I haven't looked into why this is.
Do you also have some debugger output? You said you use valgrind, for instance.
In order to look for specific leaks it could be useful for me to see if the leaks are in the CLIPS part or the wrapper (for instance: unreleased Python objects); I tried to automate most operations when it's about accessing lists of CLIPS objects (facts and rules for instance) from the wrapper, in order to avoid trivial errors. The operations you report didn't show leaks in the wrapper when I tested the list-retrieval routine in the wrapper, but as CLIPS is compiled along with the wrapper, maybe I can discover whether something happens in the CLIPS core.
Thank you,
F.
Has this been resolved? Thanks for replying!