Domanda

I am writing a C++ code in the ROOT platform. I am getting the following error:

*** Break *** segmentation violation
gdb not found, need it for stack trace
Root > Function main() busy flag cleared

I just want to know what this means (in general).

È stato utile?

Soluzione

Typically that means you have written to (or maybe read) memory you don't have permission on. Either it's just invalid memory or (if the platform supports such a concept) it's outside of the memory you own.

A common cause of this is freeing a pointer but then using it again.

Foo * pFoo = new Foo();
pFoo->Bar(); // should be fine.
delete pFoo; // pFoo now points to memory that may or may not still be an actual Foo.
pFoo->Bar(); // undefined behavior.

Altri suggerimenti

Generally, "segmentation violation" means you accessed a piece of memory that wasn't allocated to you. Usually a stray pointer is the reason for that.

The remaining is some Linux-specific message concerning a missing gdb (which would be helpful to understand the problem).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top