473,387 Members | 1,455 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,387 software developers and data experts.

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<char, string_char_traits<char>,
__default_alloc_template<true, 0> >::Rep::grab (this=0x3f0dca1e)
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<char, string_char_traits<char>,
__default_alloc_template<true, 0> >::Rep::grab (this=0x3f0dca1e)
at /usr/include/g++-3/std/bastring.h:75
#1 0x080fe985 in basic_string<char, string_char_traits<char>,
__default_alloc_template<true, 0> >::basic_string (this=0x828ab24,
str=@0xbfffedbc)
at /usr/include/g++-3/std/bastring.h:177
#2 0x0810670e in ImageData::ImageData (this=0x828ab18,
_ctor_arg=@0xbfffedb0)
at /usr/include/g++-3/stl_construct.h:48
#3 0x080ffc8b in void construct<ImageData, ImageData> (__p=0x828ab18,
__value=@0xbfffedb0) at /usr/include/g++-3/stl_construct.h:48
#4 0x080ffda2 in vector<ImageData, allocator<ImageData>
::_M_insert_aux (

this=0xbfffee58, __position=0x0, __x=@0xbfffedb0)
at /usr/include/g++-3/stl_vector.h:604
#5 0x080febab in vector<ImageData, allocator<ImageData> >::push_back
(
this=0xbfffee58, __x=@0xbfffedb0) at
/usr/include/g++-3/stl_vector.h:325
#6 0x0809072b in PickListReports::makeModel (this=0x82927a8)
at picklistreports.cpp:820
#7 0x08080f3b in vreport (robotNum=0x0, vaultName=0x828e028 "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=0xbffffa79 "picking_library",
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_main (main=0x80794d4 <main>, argc=9,
ubp_av=0xbffff914, init=0x804fd28 <_init>, fini=0x812be24 <_fini>,
rtld_fini=0x4000dc14 <_dl_fini>, stack_end=0xbffff90c)
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 4907
"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**********@dial.pipex.com> wrote in message news:<3f***********************@news.dial.pipex.co m>...
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=filteredList.begin(); pImg != filteredList.end(); ++pImg)
{
ImageData idata;
FRAG_vec::iterator 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.imageList).push_back(idata);

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.google.c om...
"Stephen Howe" <NO**********@dial.pipex.com> wrote in message news:<3f***********************@news.dial.pipex.co m>...
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=filteredList.begin(); pImg != filteredList.end();

++pImg) {
ImageData idata;
FRAG_vec::iterator 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.imageList).push_back(idata);

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.google.c om...
"Stephen Howe" <NO**********@dial.pipex.com> wrote in message news:<3f***********************@news.dial.pipex.co m>...
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=filteredList.begin(); pImg != filteredList.end();

++pImg) {
ImageData idata;
FRAG_vec::iterator 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.imageList).push_back(idata);

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
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...
0
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
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...
9
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...
7
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...
4
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...
2
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...
6
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...
12
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.