dbTalk Databases Forums  

SOLVED: Problem of memory with Row ???

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss SOLVED: Problem of memory with Row ??? in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rieu Nicolas
 
Posts: n/a

Default SOLVED: Problem of memory with Row ??? - 09-14-2006 , 01:38 AM







Hello=2E
Firstable, thanks for your help, this mailing list is very great because
it's rare to find other information elsewhere=2E

Then, we solved the problem of delete/free on a Row=2E
(Remember the following example at the end of the mail=2E)

In fact, the library mysql++ was compiled with gcc 3=2E4, but all the=
source
code and other librairies were compiled in gcc 4=2E0, but we noticed this=
kind
of incompatibility only yesterday=2E

So we compiled mysql++ with gcc4=2E0 and it's ok=2E

Stupid thing, but not easy to find out=2E

Nicolas

-----Message d'origine-----
De=A0: Rieu Nicolas [mailto:nicolas=2Erieu@capgemini=2Ecom]=20
Envoy=E9=A0: jeudi 20 juillet 2006 19:05
=C0=A0: plusplus@lists=2Emysql=2Ecom
Objet=A0: RE: Problem of memory with Row ???


Hello Warren,
I tried to launch simple1 like this:
=2E=2E=2E/simple1 [parameters]

It's ok

Well I copied the source code from simple1=2Ecpp to my program like this:

// Retrieve the sample stock table set up by resetdb
mysqlpp::Query query =3D con=2Equery();
query << "select * from stock";
mysqlpp::Result res =3D query=2Estore();

// Display results
if (res) {
// Display header
cout=2Esetf(ios::left);
cout << setw(21) << "Item" <<
setw(10) << "Num" <<
setw(10) << "Weight" <<
setw(10) << "Price" <<
"Date" << endl << endl;

// Get each row in result set, and print its contents
char buf[100];
cout<<"a:"<<endl;
mysqlpp::Row row;
cout<<"b:"<<endl;
mysqlpp::Row::size_type i;
cout<<"c:"<<endl;
for (i =3D 0; row =3D res=2Eat(i); ++i) {
cout<<"err:"<<i<<endl;
cout << setw(20) <<
row["item"] << ' ' <<
setw(9) << row["num"] << ' ' <<
setw(9) << row["weight"] << ' ' <<
setw(9) << row["price"] << ' ' <<
setw(9) << row["sdate"] <<
endl;
cout<<"bob:"<<i<<endl;
}
}
else {
cerr << "Failed to get stock table: " << query=2Eerror() <<
endl;
return 1;
}


And I've got the same problem:=20
it crashes at the line " for (i =3D 0; row =3D res=2Eat(i); ++i) {"

valgrind tells me that:

Invalid free() / delete / delete[]
operator delete(void*) (vg_replace_malloc=2Ec:155)
mysqlpp::Row::~Row() new_allocator=2Eh:86)

the features of my build environment:
compiler: gcc version 4=2E0=2E2 20051125 (Red Hat 4=2E0=2E2-8)
OS: Red Hat Enterprise Linux ES release 4 (Nahant Update 2) Kernel
2=2E6=2E9-34=2E0=2E1=2EELsmp on an i686
MySQL++: 2=2E1=2E1
Mysql 5=2E0

Do you want more information ?

Nicolas

-----Message d'origine-----
De=A0: Warren Young [mailto:mysqlpp@etr-usa=2Ecom]=20
Envoy=E9=A0: mardi 18 juillet 2006 16:19
=C0=A0: MySQL++ Mailing List
Objet=A0: Re: Problem of memory with Row ???

Rieu Nicolas wrote:
Quote:
=20
The following program (very simple) crashes at the first time it achieves
the end (}) of the block < for >=20
Your code is almost identical to the simple2 example=2E Does that run=20
successfully?

If so, try making the minimum necessary changes to simple2 to make it=20
access your database instead of the sample database=2E If it still works,=
=20
then something is wrong with your build environment=2E Otherwise, it=20
suggests that there's something in your data set that MySQL++ can't cope=20
with; provide the schema of the table so we can diagnose it=2E

If simple2 also crashes, we'll need details of your build environment to=20
make any guesses=2E Compiler, OS, MySQL++ and MySQL versions, etc=2E

--=20
MySQL++ Mailing List
For list archives: http://lists=2Emysql=2Ecom/plusplus
To unsubscribe: http://lists=2Emysql=2Ecom/plusplus?unsub=
=3Dnrieu@capgemini=2Efr



This message contains information that may be privileged or confidential=
and
is the property of the Capgemini Group=2E It is intended only for the=
person
to whom it is addressed=2E If you are not the intended recipient, you are=
not
authorized to read, print, retain, copy, disseminate, distribute, or use
this message or any part thereof=2E If you receive this message in error,
please notify the sender immediately and delete all copies of this message=
=2E


--=20
MySQL++ Mailing List
For list archives: http://lists=2Emysql=2Ecom/plusplus
To unsubscribe: http://lists=2Emysql=2Ecom/plusplus?unsub=
=3Dnrieu@capgemini=2Efr


This message contains information that may be privileged or confidential=
and is the property of the Capgemini Group=2E It is intended only for the=
person to whom it is addressed=2E If you are not the intended recipient, =
you are not authorized to read, print, retain, copy, disseminate, =
distribute, or use this message or any part thereof=2E If you receive this=
message in error, please notify the sender immediately and delete all =
copies of this message=2E


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.