0

I am attempting to use QTCreator's Memcheck tool to analyze the memory of a QT project, which is a dynamic library. It uses a QT Gui (QMainWindow) to allow the user to select a file, which is then processed, and then eventually returns to the mainwindow.

However, I cannot seem to use Memcheck properly.

When I select "Memcheck" and hit run, it instantly goes to "Analyzing memory" without ever letting the Gui pop up.

This is problematic. How can I get memcheck to work with this program?

Tyler Shellberg
  • 1,086
  • 11
  • 28
  • So the app runs but the UI never comes up? Or does it exit right away? Now that using valgrind, everything will be quite slow.. maybe try with valgrind from the CLI to see if that works in principle. – Frank Osterfeld Jan 17 '20 at 21:37
  • It appears to run, but must also time out (no user input) since it does seem to have "finished" in some sense since I get the analysis results back. I'll try valgrind from the CLI and report back. – Tyler Shellberg Jan 17 '20 at 21:43
  • It can't seem to find the DLL of the project for some reason. It can when run through QT. Weird. So I can't run it from the command line at all at the moment. – Tyler Shellberg Jan 17 '20 at 21:45
  • @FrankOsterfeld Looks like I needed to take QTCreator's LD_LIBRARY_PATH and export it in the cli to get it to run. However, when I attempt to run it, it just crashes after a couple minutes without showing the gui. The log is absurdly long, and seems to all be related to QT framework, nothing we wrote. – Tyler Shellberg Jan 17 '20 at 22:01

1 Answers1

0

I had two main issues:

1: Valgrind does not seem to play nice with QT Gui applications. It generates logs that are thousands of entries long for all the work QT is doing before it even gets to my application.

I had to make a separate, small non-GUI C++ program that would drive instead of the GUI application.

2: When trying to run from the command line, I needed to set an environment variable by using export. This needs to be the same as LD_LIBRARY_PATHS in QT Creator.

So I ran:

export LD_LIBRARY_PATH=X where X was the exact value I copied from LD_LIBRARY_PATHS in the variable from the QT Project.

Note: Running from the command line may have not be neccesary now that it isn't a GUI Application, memcheck might have passed just fine. Haven't tested since.

Tyler Shellberg
  • 1,086
  • 11
  • 28