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...

>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.

commented: *nods* +29

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...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.