473,462 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Segmentation fault in stl_list.h

Hi Guys,

I am not sure what's wrong with my program. When I ran it under the
GDB, it shows the following messages , which said that the issue is
from stl_list.h. Does anyone know what's happening in here?

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1540594608 (LWP 1661)]
dist_obj::insert_list (this=0x82d3980, priority=23704) at
stl_list.h:116
116 { _M_node = _M_node->_M_next; }

In my dist_obj::insert_list() , it just insert an character array into
the list, and on the other thread, it gets a copy of the entire list,
then clear the list, and do some manipulation.

I also though about that if this is because of lack of memory on my
machine. I ain't sure how to check that though.

I am using GCC 3.3.3. on my FC2 machine.

Can any one please give me a helping hand? Sorry for any inconvenience.

Best wishes,

Kit

Sep 26 '06 #1
2 2140
tikcireviva wrote:
I am not sure what's wrong with my program.
We're not sure either. You can see it. We cannot.
When I ran it under the
GDB, it shows the following messages , which said that the issue is
from stl_list.h. Does anyone know what's happening in here?

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1540594608 (LWP 1661)]
dist_obj::insert_list (this=0x82d3980, priority=23704) at
stl_list.h:116
116 { _M_node = _M_node->_M_next; }
Most likely either 'this' or 'this->_M_node' is an invalid pointer.
In my dist_obj::insert_list() , it just insert an character array into
How is that character array created? Is it dynamic? Is it automatic?
the list, and on the other thread, it gets a copy of the entire list,
then clear the list, and do some manipulation.
Threading is off-topic, unfortunately. C++ assumes a single thread,
a single process, on a single processor machine. All definitions in
the language are based on that.

It is quite possible, though, that your problem is not related to
threading. Does it happen if you don't use threads? Have you actually
tried your algorithm synchronously before you introduced threads?
I also though about that if this is because of lack of memory on my
machine. I ain't sure how to check that though.
Change the test case to something smaller (if possible). Watch the
memory consumption of your process. Run it under 'valgrind' or some
other memory debugging tool. But don't spend too much time on it,
unless you actually work with rather large datasets. Most likely
your problem is elsewhere.
I am using GCC 3.3.3. on my FC2 machine.
That's irrelevant, most often. We here discuss the language, not the
environment in which it's used.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Sep 26 '06 #2
Hi Victor,

I am sorry to wrongly post this message in this news group.

Finally, I got the solution.
I've changed my stl::list from
list<pair<char *,size_t
to
list<pair<char *,size_t*>
The char buffer that I've put into the pair<char*,size_tis usually
1~2kbytes. The frequency of doing a push_back() operation is around
3000 times/sec.

Still, I don't have strong evidence why after I've changed the
pair<char*,size_tto a pointer, everything will work. Actually I do
want to drill down into the problem, may you please suggest me which
news group I should goto?

I am so sorry for any inconvenience again.

Best regards,

Kit.

Victor Bazarov 寫道:
tikcireviva wrote:
I am not sure what's wrong with my program.

We're not sure either. You can see it. We cannot.
When I ran it under the
GDB, it shows the following messages , which said that the issue is
from stl_list.h. Does anyone know what's happening in here?

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1540594608 (LWP 1661)]
dist_obj::insert_list (this=0x82d3980, priority=23704) at
stl_list.h:116
116 { _M_node = _M_node->_M_next; }

Most likely either 'this' or 'this->_M_node' is an invalid pointer.
In my dist_obj::insert_list() , it just insert an character array into

How is that character array created? Is it dynamic? Is it automatic?
the list, and on the other thread, it gets a copy of the entire list,
then clear the list, and do some manipulation.

Threading is off-topic, unfortunately. C++ assumes a single thread,
a single process, on a single processor machine. All definitions in
the language are based on that.

It is quite possible, though, that your problem is not related to
threading. Does it happen if you don't use threads? Have you actually
tried your algorithm synchronously before you introduced threads?
I also though about that if this is because of lack of memory on my
machine. I ain't sure how to check that though.

Change the test case to something smaller (if possible). Watch the
memory consumption of your process. Run it under 'valgrind' or some
other memory debugging tool. But don't spend too much time on it,
unless you actually work with rather large datasets. Most likely
your problem is elsewhere.
I am using GCC 3.3.3. on my FC2 machine.

That's irrelevant, most often. We here discuss the language, not the
environment in which it's used.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Sep 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: sivignon | last post by:
Hi, I'm writing a php script which deals with 3 ORACLE databases. This script is launch by a script shell on an linux machine like this : /../php/bin/php ./MySript.php (PHP 4.3.3) My script...
3
by: diyanat | last post by:
i am writing a cgi script in C using the CGIC library, the script fails to run, i am using apache on linux error report from apache : internal server error Premature end of script headers:...
3
by: Zheng Da | last post by:
Program received signal SIGSEGV, Segmentation fault. 0x40093343 in _int_malloc () from /lib/tls/libc.so.6 (gdb) bt #0 0x40093343 in _int_malloc () from /lib/tls/libc.so.6 #1 0x40094c54 in malloc...
5
by: Fra-it | last post by:
Hi everybody, I'm trying to make the following code running properly, but I can't get rid of the "SEGMENTATION FAULT" error message when executing. Reading some messages posted earlier, I...
18
by: Digital Puer | last post by:
Hi, I'm coming over from Java to C++, so please bear with me. In C++, is there a way for me to use exceptions to catch segmentation faults (e.g. when I access a location off the end of an array)?...
27
by: Paminu | last post by:
I have a wierd problem. In my main function I print "test" as the first thing. But if I run the call to node_alloc AFTER the printf call I get a segmentation fault and test is not printed! ...
7
by: pycraze | last post by:
I would like to ask a question. How do one handle the exception due to Segmentation fault due to Python ? Our bit operations and arithmetic manipulations are written in C and to some of our...
3
by: madunix | last post by:
My Server is suffering bad lag (High Utlization) I am running on that server Oracle10g with apache_1.3.35/ php-4.4.2 Web visitors retrieve data from the web by php calls through oci cobnnection...
6
by: DanielJohnson | last post by:
int main() { printf("\n Hello World"); main; return 0; } This program terminate just after one loop while the second program goes on infinitely untill segmentation fault (core dumped) on...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.