473,767 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Core dumping at push_back for a vector (On Linux and HP)

Hi All,

I am using g++ on Linux, and my code has lot of vectors each stores a
particualr type of structure. (Structure internally had some vectors).

When I am trying to push_back an element to a one of the vectors in
the parent strutcure, it always core dumps on Linux and HP. On Solaris
the same code is working fine without any problem.

My code is actually an API, and this problem is seen only by few
callers and not by everybody on linux/HP.

Here is the stack trace of core dump, can some of you help me out
here..

#0 0x080ff6bd in basic_string<ch ar, string_char_tra its<char>,
__default_alloc _template<true, 0> >::Rep::grab (this=0x3f0dca1 e)
at /usr/include/g++-3/std/bastring.h:75
75 charT* grab () { if (selfish) return clone (); ++ref;
return data (); }
(gdb) where
#0 0x080ff6bd in basic_string<ch ar, string_char_tra its<char>,
__default_alloc _template<true, 0> >::Rep::grab (this=0x3f0dca1 e)
at /usr/include/g++-3/std/bastring.h:75
#1 0x080fe985 in basic_string<ch ar, string_char_tra its<char>,
__default_alloc _template<true, 0> >::basic_stri ng (this=0x828ab24 ,
str=@0xbfffedbc )
at /usr/include/g++-3/std/bastring.h:177
#2 0x0810670e in ImageData::Imag eData (this=0x828ab18 ,
_ctor_arg=@0xbf ffedb0)
at /usr/include/g++-3/stl_construct.h :48
#3 0x080ffc8b in void construct<Image Data, ImageData> (__p=0x828ab18,
__value=@0xbfff edb0) at /usr/include/g++-3/stl_construct.h :48
#4 0x080ffda2 in vector<ImageDat a, allocator<Image Data>
::_M_insert_au x (

this=0xbfffee58 , __position=0x0, __x=@0xbfffedb0 )
at /usr/include/g++-3/stl_vector.h:60 4
#5 0x080febab in vector<ImageDat a, allocator<Image Data> >::push_back
(
this=0xbfffee58 , __x=@0xbfffedb0 ) at
/usr/include/g++-3/stl_vector.h:32 5
#6 0x0809072b in PickListReports ::makeModel (this=0x82927a8 )
at picklistreports .cpp:820
#7 0x08080f3b in vreport (robotNum=0x0, vaultName=0x828 e028 "V1",
profileName=0x0 , sessionid=1, reportid=-1, reportFormat=0,
distInfo=0x0,
argInfo=0x0) at vreport.cpp:350
#8 0x0807fb1f in vreport (robot=0x0, vault=0x828e028 "V1",
profile=0x0,
sessionid=1) at vreport.cpp:71
#9 0x08071f28 in DoReport (rptcmd=0xbffff a79 "picking_librar y",
sessionId=1,
reportFileName= 0x0) at reports.cpp:85
#10 0x08079873 in new_main (argC=9, argV=0xbffff914 ) at vltrun.cpp:431
#11 0x080794e8 in main (argC=9, argV=0xbffff914 ) at vltrun.cpp:342
#12 0x410b8507 in __libc_start_ma in (main=0x80794d4 <main>, argc=9,
ubp_av=0xbffff9 14, init=0x804fd28 <_init>, fini=0x812be24 <_fini>,
rtld_fini=0x400 0dc14 <_dl_fini>, stack_end=0xbff ff90c)
at ../sysdeps/generic/libc-start.c:129

#6 is the place where I am using push_back.

I tried using stlport instead of g++'s STL but no use it core dumps
at the same place always.

Your help is highly appreciated in this regard.

Thanks
Ganesh.
Jul 19 '05 #1
5 4956
"Ganesh Gella" <gk******@yahoo .com> wrote...
I am using g++ on Linux, and my code has lot of vectors each stores a
particualr type of structure. (Structure internally had some vectors).

When I am trying to push_back an element to a one of the vectors in
the parent strutcure, it always core dumps on Linux and HP. On Solaris
the same code is working fine without any problem.

My code is actually an API, and this problem is seen only by few
callers and not by everybody on linux/HP.

Here is the stack trace of core dump, can some of you help me out
here..
[...]
Don't post this OS- and compiler-specific rubbish. Post code.
I tried using stlport instead of g++'s STL but no use it core dumps
at the same place always.


I can't see any "place". Neither can I see any "particular
structure". Post code.

Victor
Jul 19 '05 #2
> I tried using stlport instead of g++'s STL but no use it core dumps
at the same place always.

Your help is highly appreciated in this regard.


Then post code not meaningless crap.

Your probably using vector incorrectly, we will never know until we see some
_complete_ _compilable_ code that illustrates the problem.

Stephen Howe
Jul 19 '05 #3
"Stephen Howe" <NO**********@d ial.pipex.com> wrote in message news:<3f******* *************** *@news.dial.pip ex.com>...
I tried using stlport instead of g++'s STL but no use it core dumps
at the same place always.

Your help is highly appreciated in this regard.


Then post code not meaningless crap.

Your probably using vector incorrectly, we will never know until we see some
_complete_ _compilable_ code that illustrates the problem.

Stephen Howe


Okay, here is the code I am using

for (pImg=filteredL ist.begin(); pImg != filteredList.en d(); ++pImg)
{
ImageData idata;
FRAG_vec::itera tor pFrag;
for (pFrag=(pImg->frags).begin() ; pFrag != (pImg->frags).end() ; ++pF
rag)
{
idata.imageId = pImg->backupid;
idata.client = pImg->client;
idata.kbytes = pFrag->kilobytes;
idata.backedup_ dt = pImg->backup_time ;
idata.fragNum = pFrag->fragment;

}
(mdata.imageLis t).push_back(id ata);

Here I am getting core dump at push_back(idata ).

Posted the stack trace in previous messages.

Thanks
Ganesh.
Jul 19 '05 #4
"Ganesh Gella" <gk******@yahoo .com> wrote in message
news:d3******** *************** ***@posting.goo gle.com...
"Stephen Howe" <NO**********@d ial.pipex.com> wrote in message news:<3f******* *************** *@news.dial.pip ex.com>...
I tried using stlport instead of g++'s STL but no use it core dumps
at the same place always.

Your help is highly appreciated in this regard.


Then post code not meaningless crap.

Your probably using vector incorrectly, we will never know until we see some _complete_ _compilable_ code that illustrates the problem.

Stephen Howe


Okay, here is the code I am using

for (pImg=filteredL ist.begin(); pImg != filteredList.en d();

++pImg) {
ImageData idata;
FRAG_vec::itera tor pFrag;
for (pFrag=(pImg->frags).begin() ; pFrag != (pImg->frags).end() ; ++pF rag)
{
idata.imageId = pImg->backupid;
idata.client = pImg->client;
idata.kbytes = pFrag->kilobytes;
idata.backedup_ dt = pImg->backup_time ;
idata.fragNum = pFrag->fragment;

}
(mdata.imageLis t).push_back(id ata);

Here I am getting core dump at push_back(idata ).


The most probable situation is that your 'ImageData' has some
dynamic memory that you don't handle correctly. Find and read
about "The Rule Of Three".

Victor
Jul 19 '05 #5

"Ganesh Gella" <gk******@yahoo .com> wrote in message
news:d3******** *************** ***@posting.goo gle.com...
"Stephen Howe" <NO**********@d ial.pipex.com> wrote in message news:<3f******* *************** *@news.dial.pip ex.com>...
I tried using stlport instead of g++'s STL but no use it core dumps
at the same place always.

Your help is highly appreciated in this regard.


Then post code not meaningless crap.

Your probably using vector incorrectly, we will never know until we see some _complete_ _compilable_ code that illustrates the problem.

Stephen Howe


Okay, here is the code I am using

for (pImg=filteredL ist.begin(); pImg != filteredList.en d();

++pImg) {
ImageData idata;
FRAG_vec::itera tor pFrag;
for (pFrag=(pImg->frags).begin() ; pFrag != (pImg->frags).end() ; ++pF rag)
{
idata.imageId = pImg->backupid;
idata.client = pImg->client;
idata.kbytes = pFrag->kilobytes;
idata.backedup_ dt = pImg->backup_time ;
idata.fragNum = pFrag->fragment;

}
(mdata.imageLis t).push_back(id ata);

Here I am getting core dump at push_back(idata ).

Posted the stack trace in previous messages.

Thanks
Ganesh.


Almost certainly your ImageData object does not have a valid copy
constructor.

john
Jul 19 '05 #6

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

Similar topics

4
9801
by: Hitesh Bhatiya | last post by:
Hi all, I have written a small program to accept some socket connections, which are then added to a vector (using push_back). But after a few calls to the push_back function, it deleted the object that was added last. Could someone please tell me why this happens ? Am I doing something wrong here ?
0
1618
by: AnuSree | last post by:
Hi I am getting error with push_back, some one please help me ASAP in this aspect here am sending the needful info. _______________ Class VarbindList:
10
4024
by: ken | last post by:
hello, i'm writing a c program on a linux system. i'm debugging a segmentation fault but i don't want it to dump a core file because the memory footprint of the program is over 300Mb and i don't need it to generate a 300Mb file every time I add a new printf statement to debug the code. can i do something to prevent it from dumping the core file even when it seg faults? (is this a unix/linux thing, or a c thing?) thanks!
9
15903
by: Jeff | last post by:
Hello- Ive never used a vector or vectors in C++ so I have a question for you all. I know I can dynamically create the size I need upfront, but is it possible to create them on the fly dynamically? That is, for a 2 dim array, I want to create the first element and then push_back the columns after that:
7
7805
by: Rylan | last post by:
I'm writing a program that uses a vector of classes for storing information from a file. Unfortunately, my program causes a core dump upon attempting to add a second item to the vector. Any suggestions? Snippets from the code are below: class dataitem { public: unsigned int count,time, pointlessfield; char humantime;
4
1940
by: madhusudan.hv | last post by:
hi, Can you tell me when an application might take long time to dump core? The linux o.s is indicating that a process is dumping core, and only after 40 mins i am seeing the core file. What might be the problem? regards, Madhusudan
2
1581
by: creativeinspiration | last post by:
Hey everybody. I have an issue where pushing a new item onto an STL vector, I get a core dump. Now, the capacity of the vector is not exceeded (its only 3). The vector contains integers. Now, in my application, I push stuff to the vector and works fine until that one point. Basically, I do this: vector<int> vec; vec.push_back(newInt); and get a core dump. Now, the function which involves this, is part of the class reached from...
6
11616
by: jmsanchezdiaz | last post by:
CPP question: if i had a struct like "struct str { int a; int b };" and a vector "std::vector < str test;" and wanted to push_back a struct, would i have to define the struct, fill it, and then push_back it, or could i pushback the two ints directly somehow? Thanks for all.
12
2943
by: jabbah | last post by:
Hi, I just found, that code that ran under Visual Studio 8 doesnt run under 9 anymore and now im seeking confirmation of whether my code is unsafe and just accidentially worked or what one can expect from a standard conforming implementation of STL. The basic thing is that, given a vector V with some elements in it, I want to push_back one of these elements, like this: #include <iostream> #include <vector> #include <cassert> using...
0
9571
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9838
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8835
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.