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

glibc detected *** corrupted double-linked list problem

hi,
I have one program runs fine on my i386 linux box but get the "glibc
detected *** corrupted double-linked list" error on the x86_64 linux
box. Please help me to figure out if it is my program's problem or the
library's problem. The libraries I am using is the boost and stl. The
original program is quite long and I shrink it short and still able to
duplicate the error. Basically, I first create a priority queue and
after several round of pop the queue the error message comes up. The
x86_64 is just installed so the packages there are most current,
comparing to those in the i386 box.

Here is the testing part:
-------------------------------------------------
#include <queue>
#include "Point2i.h"
#include "myUnit.h"
#include <boost/shared_ptr.hpp>
#include <iostream>

int main(int, char *[])
{
std::priority_queue<boost::shared_ptr<myUnit>,std: :vector<
boost::shared_ptr<myUnit, ptr_less< boost::shared_ptr<myUnit >
priorityQ;
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++){
boost::shared_ptr<Point2ip(new Point2i(i,j));
boost::shared_ptr<myUnitunit(new myUnit(std::rand(), p, i, j));
priorityQ.push(unit);
}

while (!priorityQ.empty()){
std::cout<<priorityQ.size()<<" "<<std::flush;
priorityQ.pop();
std::cout<<priorityQ.size()<<std::endl;
}
}

----------------------------------------------
#ifndef POINT2I_H
#define POINT2I_H

class Point2i{
public:
int x, y;
void operator=(const Point2i & p);
Point2i(int x, int y){
this->x = x;
this->y = y;
}
~Point2i();
};

#endif
---------------------------------------------------
#include "Point2i.h"

void Point2i::operator=(const Point2i &right){
this->x = right.x;
this->y = right.y;
}

Point2i::~ Point2i(){}
--------------------------------------------------
#include "myUnit.h"

myUnit::myUnit(const double delta, const shared_ptr<Point2i>& p, const
unsigned short aCount, const unsigned short bCount) {
this->delta = delta;
this->p = p;
this->aCount = aCount;
this->bCount = bCount;
}

myUnit::~myUnit(){
p.~shared_ptr();
}
-----------------------------------------------------
#define MYUNIT_H

#include "Point2i.h"
#include <boost/shared_ptr.hpp>

using namespace boost;

class myUnit {
public:
double delta;
shared_ptr<Point2ip;
unsigned short aCount, bCount;
myUnit(const double delta, const shared_ptr<Point2i>& p, const
unsigned short aCount, const unsigned short bCount);
~myUnit();
bool operator<(const myUnit & right) const {
return delta right.delta;
};
};

template <typename Pointer>
struct ptr_less{
bool operator()(const shared_ptr<myUnit& lhs, const
shared_ptr<myUnit& rhs){
return *lhs < *rhs ;
}
};
#endif
----------------------------------------------------

Here is the result from i386 machine, no error:
9 8
8 7
7 6
6 5
5 4
4 3
3 2
2 1
1 0

Here is the result from x86_64 machine with error:
9 8
8 7
7 6
6 *** glibc detected *** corrupted double-linked list:
0x00000000006d5950 ***
Aborted

Thanks for your help. Have a good weekend.

zl2k

Jan 26 '07 #1
2 19153
On Fri, 26 Jan 2007 09:01:21 -0800, zl2k wrote:
hi,
I have one program runs fine on my i386 linux box but get the "glibc
detected *** corrupted double-linked list" error on the x86_64 linux
box. Please help me to figure out if it is my program's problem or the
library's problem. The libraries I am using is the boost and stl. The
original program is quite long and I shrink it short and still able to
duplicate the error. Basically, I first create a priority queue and
after several round of pop the queue the error message comes up. The
x86_64 is just installed so the packages there are most current,
comparing to those in the i386 box.
[...]

--------------------------------------------------
#include "myUnit.h"

myUnit::myUnit(const double delta, const shared_ptr<Point2i>& p, const
unsigned short aCount, const unsigned short bCount) {
this->delta = delta;
this->p = p;
this->aCount = aCount;
this->bCount = bCount;
}

myUnit::~myUnit(){
p.~shared_ptr();
}
This may be quite irrelevant, but is there a good reason to call p's
destructor explicitly here?
----------------------------------------------------- #define MYUNIT_H

#include "Point2i.h"
#include <boost/shared_ptr.hpp>

using namespace boost;

class myUnit {
public:
double delta;
shared_ptr<Point2ip;
unsigned short aCount, bCount;
myUnit(const double delta, const shared_ptr<Point2i>& p, const
unsigned short aCount, const unsigned short bCount);
~myUnit();
bool operator<(const myUnit & right) const {
return delta right.delta;
};
};

template <typename Pointer>
struct ptr_less{
bool operator()(const shared_ptr<myUnit& lhs, const
shared_ptr<myUnit& rhs){
return *lhs < *rhs ;
}
};
#endif
[...]

--
Lionel B
Jan 26 '07 #2


On Jan 26, 12:58 pm, "Lionel B" <m...@privacy.netwrote:
On Fri, 26 Jan 2007 09:01:21 -0800, zl2k wrote:
hi,
I have one program runs fine on my i386 linux box but get the "glibc
detected *** corrupted double-linked list" error on the x86_64 linux
box. Please help me to figure out if it is my program's problem or the
library's problem. The libraries I am using is the boost and stl. The
original program is quite long and I shrink it short and still able to
duplicate the error. Basically, I first create a priority queue and
after several round of pop the queue the error message comes up. The
x86_64 is just installed so the packages there are most current,
comparing to those in the i386 box.[...]

--------------------------------------------------
#include "myUnit.h"
myUnit::myUnit(const double delta, const shared_ptr<Point2i>& p, const
unsigned short aCount, const unsigned short bCount) {
this->delta = delta;
this->p = p;
this->aCount = aCount;
this->bCount = bCount;
}
myUnit::~myUnit(){
p.~shared_ptr();
}This may be quite irrelevant, but is there a good reason to call p's
destructor explicitly here?
----------------------------------------------------- #define MYUNIT_H
#include "Point2i.h"
#include <boost/shared_ptr.hpp>
using namespace boost;
class myUnit {
public:
double delta;
shared_ptr<Point2ip;
unsigned short aCount, bCount;
myUnit(const double delta, const shared_ptr<Point2i>& p, const
unsigned short aCount, const unsigned short bCount);
~myUnit();
bool operator<(const myUnit & right) const {
return delta right.delta;
};
};
template <typename Pointer>
struct ptr_less{
bool operator()(const shared_ptr<myUnit& lhs, const
shared_ptr<myUnit& rhs){
return *lhs < *rhs ;
}
};
#endif[...]

--
Lionel B
That does not matter even take it off.

Jan 26 '07 #3

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

Similar topics

2
by: Nate | last post by:
Hello, I am trying to recover a SQL Server 7 database from another hard disk drive that has a corrupted Windows 2000 Advanced Server installation. I am not able to repair the corrupted Windows...
6
by: Lee | last post by:
Thanks for the many responses to my original posting on 2/13 in which I asked for help about record corruptions which were occuring in a Access 2k table. After reading, printing and reading again...
3
by: Paminu | last post by:
I get this error after running my application for some time. What does it mean and what should I be looking for in my code?
1
by: mahiapkum | last post by:
hello all i have a code which looks fine when reviewed but when the application has a long run say for example of 2 days it gets exit, because of glibc error and the sample code is as follows: while...
36
by: gert | last post by:
Any comments why char **page doesn't reallocate #include <stdlib.h> void add(char **page,char *line,int n) { char **temp; if(temp=realloc(page,sizeof(char *)*(n+1))) {
0
by: shrik | last post by:
I have following error : Total giant files in replay configuration file are : File name : /new_file/prob1.rec Given file /new_file/prob1.rec is successfully verified. Splitting for giant file...
4
by: shrik | last post by:
I have following error : Total giant files in replay configuration file are : File name : /new_file/prob1.rec Given file /new_file/prob1.rec is successfully verified. Splitting for giant file...
1
by: shiznit | last post by:
I made a program that finds a minimum spanning tree. In my main I created kruskal k; and called k.findMST(); void kruskal :: findMST(){
2
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $...
5
by: Nickolai Leschov | last post by:
Hello, I'm reading code for time function in glibc and I see the following fragment in file time\time.h: /* Return the time now, and store it in *TIMER if not NULL. */ time_t time (timer)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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,...

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.