473,320 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Address 0xc00a9553 out of bounds inside stl::vector class

hi,
i got a program that is suppose to run 24x7x365. However after
functioning for around 15 minutes, it crashes due to a segmentation
fault. program is written in c++ and runs in RH Linux 4. When
inspected one of the parameters of the crashing frame, i get the
following output.

NOTE : c1 is a std::vector

(gdb) pvector c1
elem[0]: $1 = {
static npos = 4294967295,
_M_dataplus = {
<std::allocator<char>= {
<__gnu_cxx::new_allocator<char>= {<No data fields>}, <No data
fields>},
members of
std::basic_string<char,std::char_traits<char>,std: :allocator<char>
>::_Alloc_hider:
_M_p = 0xc00a9553 <Address 0xc00a9553 out of bounds>
}
}

...... and more elements like this ....

according to this out put, _M_p member is not accessible because
address 0xc00a9553 is out of bounds, and the only reason i can think
of is a memory corruption. Is there any other reason for this to
happen.


Aug 14 '08 #1
7 3865
e2*****@yahoo.com wrote:
hi,
i got a program that is suppose to run 24x7x365. However after
functioning for around 15 minutes, it crashes due to a segmentation
fault. program is written in c++ and runs in RH Linux 4. When
inspected one of the parameters of the crashing frame, i get the
following output.

NOTE : c1 is a std::vector

(gdb) pvector c1
elem[0]: $1 = {
static npos = 4294967295,
_M_dataplus = {
<std::allocator<char>= {
<__gnu_cxx::new_allocator<char>= {<No data fields>}, <No data
fields>},
members of
std::basic_string<char,std::char_traits<char>,std: :allocator<char>
>::_Alloc_hider:
_M_p = 0xc00a9553 <Address 0xc00a9553 out of bounds>
}
}

..... and more elements like this ....

according to this out put, _M_p member is not accessible because
address 0xc00a9553 is out of bounds, and the only reason i can think
of is a memory corruption. Is there any other reason for this to
happen.

Instead of accessing the vector elements with the operator[], use at()
method, and you will be able to easier find where is the problem.
Otherwise use something like valgrind to determine cause
Aug 14 '08 #2
On 8/14/2008 12:28 PM, e2*****@yahoo.com wrote:
hi,
i got a program that is suppose to run 24x7x365. However after
functioning for around 15 minutes, it crashes due to a segmentation
fault. program is written in c++ and runs in RH Linux 4. When
inspected one of the parameters of the crashing frame, i get the
following output.

NOTE : c1 is a std::vector

(gdb) pvector c1
elem[0]: $1 = {
static npos = 4294967295,
_M_dataplus = {
<std::allocator<char>= {
<__gnu_cxx::new_allocator<char>= {<No data fields>}, <No data
fields>},
members of
std::basic_string<char,std::char_traits<char>,std: :allocator<char>
>::_Alloc_hider:
_M_p = 0xc00a9553 <Address 0xc00a9553 out of bounds>
}
}

..... and more elements like this ....

according to this out put, _M_p member is not accessible because
address 0xc00a9553 is out of bounds, and the only reason i can think
of is a memory corruption. Is there any other reason for this to
happen.
You have an error at line 42

S.
--
Stefan Naewe stefan dot naewe at atlas-elektronik dot com
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
Aug 14 '08 #3
On 8/14/2008 12:33 PM, anon wrote:
e2*****@yahoo.com wrote:
>hi,
i got a program that is suppose to run 24x7x365. However after
functioning for around 15 minutes, it crashes due to a segmentation
fault. program is written in c++ and runs in RH Linux 4. When
inspected one of the parameters of the crashing frame, i get the
following output.

NOTE : c1 is a std::vector

(gdb) pvector c1
elem[0]: $1 = {
static npos = 4294967295,
_M_dataplus = {
<std::allocator<char>= {
<__gnu_cxx::new_allocator<char>= {<No data fields>}, <No data
fields>},
members of
std::basic_string<char,std::char_traits<char>,std ::allocator<char>
>>::_Alloc_hider:
_M_p = 0xc00a9553 <Address 0xc00a9553 out of bounds>
}
}

..... and more elements like this ....

according to this out put, _M_p member is not accessible because
address 0xc00a9553 is out of bounds, and the only reason i can think
of is a memory corruption. Is there any other reason for this to
happen.


Instead of accessing the vector elements with the operator[], use at()
method, and you will be able to easier find where is the problem.
Otherwise use something like valgrind to determine cause
I'd rather suggest following this

http://www.parashift.com/c++-faq-lit...t.html#faq-5.8
to get a sensible answer.

S.
--
Stefan Naewe stefan dot naewe at atlas-elektronik dot com
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
Aug 14 '08 #4
Stefan Naewe wrote:
On 8/14/2008 12:33 PM, anon wrote:
>e2*****@yahoo.com wrote:
>>hi,
i got a program that is suppose to run 24x7x365. However after
functioning for around 15 minutes, it crashes due to a segmentation
fault. program is written in c++ and runs in RH Linux 4. When
inspected one of the parameters of the crashing frame, i get the
following output.

NOTE : c1 is a std::vector

(gdb) pvector c1
elem[0]: $1 = {
static npos = 4294967295,
_M_dataplus = {
<std::allocator<char>= {
<__gnu_cxx::new_allocator<char>= {<No data fields>}, <No data
fields>},
members of
std::basic_string<char,std::char_traits<char>,st d::allocator<char>
::_Alloc_hider:
_M_p = 0xc00a9553 <Address 0xc00a9553 out of bounds>
}
}

..... and more elements like this ....

according to this out put, _M_p member is not accessible because
address 0xc00a9553 is out of bounds, and the only reason i can think
of is a memory corruption. Is there any other reason for this to
happen.

Instead of accessing the vector elements with the operator[], use at()
method, and you will be able to easier find where is the problem.
Otherwise use something like valgrind to determine cause

I'd rather suggest following this

http://www.parashift.com/c++-faq-lit...t.html#faq-5.8
to get a sensible answer.
Well... You are right, but I just gave him few useful advices regarding
the subject, as I see no questions in his post.
Aug 14 '08 #5
On Aug 14, 4:29*pm, anon <a...@no.nowrote:
Stefan Naewe wrote:
On 8/14/2008 12:33 PM, anon wrote:
e2po...@yahoo.com wrote:
hi,
i got a program that is suppose to run 24x7x365. However after
functioning for around 15 minutes, it crashes due to a segmentation
fault. program is written in c++ and runs in RH Linux 4. When
inspected one of the parameters of the crashing frame, i get the
following output.
>NOTE : c1 is a std::vector
>(gdb) pvector c1
elem[0]: $1 = {
* static npos = 4294967295,
* _M_dataplus = {
* * <std::allocator<char>= {
* * * <__gnu_cxx::new_allocator<char>= {<No data fields>}, <No data
fields>},
* * members of
std::basic_string<char,std::char_traits<char>,std ::allocator<char>
::_Alloc_hider:
* * _M_p = 0xc00a9553 <Address 0xc00a9553 out of bounds>
* }
}
>..... and more elements like this ....
>according to this out put, _M_p member is not accessible because
address 0xc00a9553 is out of bounds, and the only reason i can think
of is a memory corruption. Is there any other reason for this to
happen.
Instead of accessing the vector elements with the operator[], use at()
method, and you will be able to easier find where is the problem.
Otherwise use something like valgrind to determine cause
I'd rather suggest following this
* *http://www.parashift.com/c++-faq-lit...t.html#faq-5.8
to get a sensible answer.

Well... You are right, but I just gave him few useful advices regarding
the subject, as I see no questions in his post.
OK, sorry if the post is not clear.

(gdb) pvector c1
elem[0]: $1 = {
static npos = 4294967295,
_M_dataplus = {
<std::allocator<char>= {
<__gnu_cxx::new_allocator<char>= {<No data fields>}, <No data
fields>},
members of
std::basic_string<char,std::char_traits<char>,std: :allocator<char>
>::_Alloc_hider:
_M_p = 0xc00a9553 <Address 0xc00a9553 out of bounds>
}

}

the above is a part of the output i got when i inspected a std::vector
variable in gdb. As can be seen, _M_p member is not in an accessible
memory location.
And i think this is a result of a memory corruption, but wondering
whether this can happen to any other reason than a memory corruption.
Aug 14 '08 #6
On 14 Aug., 12:28, e2po...@yahoo.com wrote:
hi,
according to this out put, _M_p member is not accessible because
address 0xc00a9553 is out of bounds, and the only reason i can think
of is a memory corruption. Is there any other reason for this to
happen.
It likely is a memory corruption, but could also be accessing (1) the
memory-location of an object that has ceased to exist or by (2)
accessing something as an object that never was:

(1)
int* x = new int;
delete x;
*x = 1;

(2)
int* x
*x = 1;

Other stuff could provoke this error as well, but these are the most
likely, IMHO.

/Peter
Aug 14 '08 #7
On Aug 14, 6:32*pm, peter koch <peter.koch.lar...@gmail.comwrote:
On 14 Aug., 12:28, e2po...@yahoo.com wrote:
hi,
according to this out put, _M_p member is not accessible because
address 0xc00a9553 is out of bounds, and the only reason i can think
of is a memory corruption. Is there any other reason for this to
happen.

It likely is a memory corruption, but could also be accessing (1) the
memory-location of an object that has ceased to exist or by (2)
accessing something as an object that never was:

(1)
int* x = new int;
delete x;
*x = 1;

(2)
int* x
*x = 1;

Other stuff could provoke this error as well, but these are the most
likely, IMHO.

/Peter
Hi,
thanks for the reply.
Yas i agree with you, but i think i can assume that this kind of
errors are not present in the code because i had a through look in to
the code to see anything like that is present. This forces me to
consider this to be a memory corruption.
To find the corrupting place, i ran the binary under valgrind memcheck
tool. This slows down the process by almost 100, and after a long time
(2 days of continuous operation), i got an error from valgrind saiying
some memory allocation has failed. here is it:

**10032** new/new[] failed and should throw an exception, but Valgrind
cannot throw exceptions and so is aborting instead. Sorry.
==10032== at 0x4004631: VALGRIND_PRINTF_BACKTRACE (valgrind.h:3695)
==10032== by 0x4005148: operator new[](unsigned)
(vg_replace_malloc.c:268)
==10032== by 0x8197F1B:
_CORBA_Sequence_Octet::operator<<=(cdrStream&) (seqTemplatedecls.h:
168)
==10032== by 0x8195649:
_0RL_cd_5DD34BCFA8420D37_11000000::unmarshalArgume nts(cdrStream&)
(documentmessages.h:123)
==10032== by 0x40EDD4E:
omni::GIOP_S::ReceiveRequest(omniCallDescriptor&) (in /ld/work/c10728/
esp/lib/libomniORB4.so.0.7)
==10032== by 0x40CD50F: omniCallHandle::upcall(omniServant*,
omniCallDescriptor&) (in /ld/work/c10728/esp/lib/libomniORB4.so.0.7)
==10032== by 0x8192A49:
interfaces::alertinginternal::_impl_ae_sessions::_ dispatch(omniCallHandle&)
(alertinginternalstub.cpp:1393)
==10032== by 0x40BCAF5: omni::omniOrbPOA::dispatch(omniCallHandle&,
omniLocalIdentity*) (in /ld/work/c10728/esp/lib/libomniORB4.so.0.7)
==10032== by 0x40A028C:
omniLocalIdentity::dispatch(omniCallHandle&) (in /ld/work/c10728/esp/
lib/libomniORB4.so.0.7)
==10032== by 0x40ED210: omni::GIOP_S::handleRequest() (in /ld/work/
c10728/esp/lib/libomniORB4.so.0.7)
==10032== by 0x40ED0B6: omni::GIOP_S::dispatcher() (in /ld/work/
c10728/esp/lib/libomniORB4.so.0.7)
==10032== by 0x40E9DD1: omni::giopWorker::real_execute() (in /ld/
work/c10728/esp/lib/libomniORB4.so.0.7)
==10032==
==10032== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 180174
from 4)
==10032== malloc/free: in use at exit: 460,635,839 bytes in 22,318,880
blocks.
==10032== malloc/free: 2,011,424,148 allocs, 1,989,105,267 frees,
142,332,360,008 bytes allocated.
==10032== For a detailed leak analysis, rerun with: --leak-check=yes
==10032== For counts of detected errors, rerun with: -v
the machine this has run had ebough of memory and im certain that the
program does not have huge memory leaks. So im not sure why the 'new'
operator has failed. Can it be a problem with valgrind it self?
Can you recommend me a good memory corruption detection tool for Linux
other than valgrind? im OK to recompile/re-link.
I've already tried NJAMD and electric fence but was not that helpful.
its enough if it can detect memory overflows.

Thanks
Aug 15 '08 #8

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

Similar topics

4
by: Zheka | last post by:
we're dealing the following problem: d:\Program Files\Microsoft Visual Studio .NET\Vc7\include\vector(575): error C2440: 'initializing' : cannot convert from 'const Game' to 'Game' This...
6
by: Vasileios Zografos | last post by:
Hello, I have a function that generates some values (e.g. vertices in 2d space) the number of which I dont know. So, it could generate 20 vertices, 100 vertices, or even 1 vertex. void...
17
by: Havatcha | last post by:
Does anyone have a benchmark for the processing overhead of the STL Vector class, vs a C style array? I would dearly love to use Vectors, but am paranoid about slowing my real-time code down. Can...
6
by: ken.carlino | last post by:
>From http://www.parashift.com/c++-faq-lite/references.html#faq-8.6, it said "Use references when you can, and pointers when you have to." And I need to convert this java class to c++: public...
10
by: Allerdyce.John | last post by:
Hi, I have a class with a STL vector as it attribute. How can I create a method which just return a 'read-only' view? (i.e. the caller of the function can only read the vector, not write it)? ...
0
by: santana | last post by:
Hi I've created a class to be used with stl vector. I'm having a hard time decipher the error message outpout by g++... burlen@quaoar:~/hdf52vtk_dev/src$ g++ junk.cpp GridPoint.o...
9
by: Christian Chrismann | last post by:
Hi, I've a runtime problem with STL vectors. Here is the simplified version of the code: template <class Tclass A { ... private: vector<T*myvector; typename vector<T*>::itarator mIt;
1
by: krunalbauskar | last post by:
Hi, Explicit instantiation of STL vector demands explicit instantiation of all the templates it using internally. For example - <snippet> #include <iostream> #include <vector>
5
by: cbbibleboy | last post by:
Hey, I've been getting some very strange results with what seems to be very simple code. All I'm doing is trying to use an STL vector of "cSprite"s -- a class I wrote. The problem arises when I try...
2
by: Builder | last post by:
How can I import the following COM interface to C#? DECLARE_INTERFACE_(IVertices, IUnknown) { STDMETHOD(get_vertices) (THIS_ vector<POINT>& vertices) PURE; STDMETHOD(set_vertices) (THIS_...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.