All right...This is my first post and it is a very short question. I'm getting a segmentation fault at this line:

std::ostringstream ostr;

All I'm doing is creating an ostringstream. Sometimes it makes it past this line and is fine but others I'll get a segfault here. I am using threads and I've looked around but haven't found much info about threads with ostringstream.

Any ideas about why it would segfault here? It doesn't seem to me that creating this would cause a segfault...

9 Years
Discussion Span
Last Post by freddyfly

>It doesn't seem to me that creating this would cause a segfault...
Just because it dies there doesn't mean the problem occurs there. Don't confuse the symptom for the cause and you'll understand why memory errors are among the more insidious bugs you can encounter.

Sadly, you haven't provided enough information for me to help you. Try writing a complete bare bones program that exhibits the problem so some of us can troubleshoot on our side.

Votes + Comments

Hmmmm ok so I am probably just looking in the wrong place...would the problem likely be caused by the same thread that is throwing the segfault or could it be any?

This ostringstream is not in my code, I'm building on someone else's and haven't used ostringstreams before and am pretty new to lots of threads so I'm just trying to figure this out...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.