Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code analysis with Valgrind and Infer #109

Open
mindhells opened this issue May 21, 2020 · 4 comments
Open

Code analysis with Valgrind and Infer #109

mindhells opened this issue May 21, 2020 · 4 comments

Comments

@mindhells
Copy link
Member

mindhells commented May 21, 2020

I'm working on this branch. There I've added Valgrind and Infer tools for the C++ examples.

Examples readme has also been updated there explaining how to run the examples using Valgrind.
No memory leaks detected so far in the C++ model... and that's the reason me opening this issue: is that true or am I doing something wrong?

@edyoung
Copy link
Member

edyoung commented May 21, 2020

Cool! You could try introducing av Leah d deliberately and see if it is reported...

@mindhells
Copy link
Member Author

Good point. I guess I assumed there should be some, maybe because I underestimated the current implementation.

I know this analysis won't prove much about Gnofract4d running in GUI mode. For in that case, there's "objects" being reused or disposed depending on the use case (changing the formula o zooming in/out), and to find if there's leaking there I suppose you'll need python specific tools like Pympler.

I still find tricky, when creating Python extensions, to deal with reference counting. I wonder if there's a manageable way to find leaking problems there.

@edyoung
Copy link
Member

edyoung commented May 23, 2020

Re: leaking problems, I had a crappy manual way to deal with that. If you enable #DEBUG_ALLOCATION=1 you get some debug spew which logs when each python-referenced object is created or destroyed. You run the program, record the trace, then sort the output. If there is a line with 0x12345 : FOO : CTOR not followed by a 0x12345 : FOO : DTOR then you leaked a FOO. Crude, but found a number of bugs that way.

@mindhells
Copy link
Member Author

No time to try it out yet, but I'll drop here this interesting piece of info, just in case someone runs into this issue: https://pythonextensionpatterns.readthedocs.io/en/latest/debugging/valgrind.html#building-python-for-valgrind-label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants