| | |
About multi-threading and -D_GLIBCXX_DEBUG
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2008
Posts: 31
Reputation:
Solved Threads: 0
Hi everybody,
I am having some problems with a multi-threaded application I am developing. I get segmentation faults in different places, always related to std::string, using g++4.3.2 on Ubuntu 8.10 server. Here is an example:
The obvious to think is that std::string is not thread safe (and I use this extensively). I couldn't find very recent threads on the web about this, but I found an advice to compile with the flag -D_GLIBCXX_DEBUG.
This flag indeed eliminates (at least apparently) the concurrency issue with the strings.
I tried the application in windows VC++ 2008 and in this platform everything works fine [EDITED]in DEBUG mode only, although I didn't specifically set the flag.[/EDITED]
I couldn't find much info on this and there are some questions I would like to have answered like:
Thanks in advance
I am having some problems with a multi-threaded application I am developing. I get segmentation faults in different places, always related to std::string, using g++4.3.2 on Ubuntu 8.10 server. Here is an example:
#0 0xb7e18bb6 in memcpy () from /lib/tls/i686/cmov/libc.so.6 (gdb) up #1 0xa8eb1014 in ?? () (gdb) up #2 0xb7fca1ef in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string () from /usr/lib/libstdc++.so.6
The obvious to think is that std::string is not thread safe (and I use this extensively). I couldn't find very recent threads on the web about this, but I found an advice to compile with the flag -D_GLIBCXX_DEBUG.
This flag indeed eliminates (at least apparently) the concurrency issue with the strings.
I tried the application in windows VC++ 2008 and in this platform everything works fine [EDITED]in DEBUG mode only, although I didn't specifically set the flag.[/EDITED]
I couldn't find much info on this and there are some questions I would like to have answered like:
- What changes in concrete when we use the flag?
- It is still a debug mode so, will it degrade the performance if compiled without -g and with -D_GLIBCXX_DEBUG?
- Why is windows std::string thread safe and not g++?
- Any other solutions for this issue?
Thanks in advance
Last edited by rmlopes; Jul 9th, 2009 at 12:50 pm. Reason: See the tags EDITED
![]() |
Similar Threads
- Multi-threading Vs. Distributed Computing (C++)
- Multi Threading (C#)
- SAFE multi-threading???????? (C++)
- Multi threading problem. (C++)
- Threading in C (C)
- Threading (multi threading) in Linux (C)
- Multi-threading with C++.NET (C++)
Other Threads in the C++ Forum
- Previous Thread: Can we use hash tables to read the binary data from a file?
- Next Thread: Problem about the return value type of generic algorithm find().
Views: 191 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll dynamic encryption error file forms fstream function functions game givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linker linux loop looping loops map math matrix memory microsoft newbie news number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort stream string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





