Error message when starting visualization command

Hello everyone,

I am currently trying to run a code from a previous master student, in which he simulates a detector. I want to build upon his work for my own research, however there are some problems.

I can compile the program and run it, IF I cancel all the lines that are connected to the visualization. If I don’t cancel these lines, it gives me following error in the terminal:

free(): invalid next size (fast)
Aborted (core dumped)

If I debug it with data display debugger (ddd), it gives me following error, at the line: ui->SessionStart();

I tried to google these errors but couldn’t find anything helpful. The visualization program I use is QT. It’s hard for me to pinpoint down the problem, as the error occurs at almost the end of the whole program, only followed by delete visManager; and delete runManager;.

Does anyone have any advice on how to approach this error?

Best regards

I’ve not seen this before. What type of Linux are you using? What version? What version of Qt?

Did you follow the instructions in the Installation Guide? Did you use cmake? Did you build the Geant4 libraries yourself? What version of Geant4?

Sorry to to be more helpful.

1 Like

Hey Allison,

thank you for your reply! So to answer your questions:

What type of Linux are you using? What version?
Ubuntu 18.04.3 LTS

What version of Qt?
Qt version 4.8.7

Did you follow the instructions in the Installation Guide?
Yes, I followed the instructions. Furthermore, I already wrote some own codes with visualization for a month now that are working with my version of qt.

Did you use cmake?
To compile my programs I use:
cmake pathToFile
in a build folder.

Did you build the Geant4 libraries yourself?
I am not quite sure. I installed it according to the installation guide
Installationguide Geant4:
with following packages:


What version of Geant4?

I hope that answers your questions!

If you need more information, just let me know.

Hi JK70

All looks good but please try upgrading to Qt5. If you stay with Qt4 you have to force some parameters (can’t recall exactly). I’m working with Qt5.13.

You may have to ask your System Manager to re-install Qt, and then rebuild Geant4. (For Qt5 you have to add
I have
-DCMAKE_PREFIX_PATH="~/Qt/Qt5.13.0/5.13.0/clang_64" \

See Installation Guide:

    • If set to ON , build Qt4/5 User Interface and Visualization drivers. Requires: Qt4 or Qt5 and OpenGL libraries and headers. Qt5 will be searched for first. If it is not found Qt4 will be searched for. This behaviour can be adjusted through the advanced option GEANT4_FORCE_QT4 .See the QT_QMAKE_EXECUTABLE and CMAKE_PREFIX_PATH
    • If you have software packages required by Geant4 installed in custom locations, this variable can be set to list these prefixes to help CMake locate the packages. For example, if Xerces-C is needed and installed in /custom/xerces-c , then CMAKE_PREFIX_PATH could be set on the command line as:

Hope this helps

1 Like

Hello Alisson,

thank you very much for your tips. I reinstalled qt and now I am using QT version 5.9.5… However, it doesn’t solve my problem. After running the code, the qt window opens up for a fraction of a fraction and the terminal output is as follows:

terminate called after throwing an instance of ‘std::bad_alloc’
what(): std::bad_alloc
Aborted (core dumped)

After running it with my debugger I get following error again (at the line ui -> SessionStart();):



This looks like a system configuration issue. Why is your app looking in Dropbox? You might need to set an environment variable to make sure your app picks up the right libraries. Talk to you system manager.

Sorry not to be more helpful. It’s not a problem I’ve seen before.


Hey John,

I compiled the code in my dropbox to be able to work on it on different machines. However, I compiled it on my computer to circumvent possible problems, but the error stays the same.

I’m confused, why it is even looking for a folder sysdeps? I guess David, the guy who wrote the code, had something installed in his folder from where he ran the code?

Thank you for your help anyway, I’ll talk to some IT guys around here!


Hey John,

well, I figured it out.

In one file there was an array overflow, he tried to access the entry #6 but the array is only of size 4. Weirdly, I didn’t get an error message which pointed to the specific bug. It only lead to the errors described above.

It is fixed now anyway, I can finally go on with implementing my changes!


OK, glad you figured it out. (It was all very puzzling.)