Error running Macro


When I try running my macro for the first time, it runs just fine. But when I run it a second (or 3, 4, … times) I get the following error:

*** Break *** segmentation violation

[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)

[/usr/lib/system/libsystem_malloc.dylib] virtual_default_zone (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] llvm::Module::~Module() (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] std::__1::__shared_ptr_pointer<llvm::Module*, std::__1::default_delete<llvm::Module>, std::__1::allocator<llvm::Module> >::__on_zero_shared() (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] cling::Interpreter::unload(cling::Transaction&) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] cling::Interpreter::unload(unsigned int) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] cling::MetaSema::actOnUCommand(llvm::StringRef) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] cling::MetaSema::actOnLCommand(llvm::StringRef, cling::Transaction**) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] cling::MetaSema::actOnxCommand(llvm::StringRef, llvm::StringRef, cling::Value*) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] cling::MetaParser::isXCommand(cling::MetaSema::ActionResult&, cling::Value*) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] cling::MetaParser::isCommand(cling::MetaSema::ActionResult&, cling::Value*) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] TApplication::ExecuteFile(char const*, int*, bool) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] TRint::ProcessLineNr(char const*, char const*, int*) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] TRint::HandleTermInput() (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] TUnixSystem::CheckDescriptors() (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] TMacOSXSystem::DispatchOneEvent(bool) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] TSystem::InnerLoop() (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] TSystem::Run() (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] TApplication::Run(bool) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/lib/root/] TRint::Run(bool) (no debug info)

[/usr/local/Cellar/root/6.20.04_1/bin/root.exe] main (no debug info)

[/usr/lib/system/libdyld.dylib] start (no debug info)

[<unknown binary>] (no debug info)

My macro has a function named after the same name as the file name. And there are two more additional functions. I tried .x and .L both but the same problem persists.


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.20/04
Platform: MacOS
Compiler: Not Provided

It looks like something being re-allocated or not de-allocated properly. Can you post you macro here ?

Yes, sure here it is. @couet
Si22DecayProton5.C (26.7 KB)

The data file is missing.

Can you try to make your arrays x and y std::vectors instead of double[100000], please?

Unrelated but still problematic, you are doing several floating point to integer conversion, where your result is basically “random”, e.g. g1->SetPoint(i*4, i, sum); with i being a double: it might store your intended 0.25 as 0.249999998 and that *4 and converted to int might give 0, not 1!

I don’t see anything obviously wrong, so either allow us to reproduce this by sharing the required files, or consider running valgrind (if you’re on Linux) on it to see what’s broken. See Valgrind and ROOT

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.