dbTalk Databases Forums  

Problem of memory with Row ???

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


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



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

Default Problem of memory with Row ??? - 07-12-2006 , 12:24 PM






------=_NextPart_000_02BB_01C6A5E8.9C8D27D0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit


Hello all.



The following program (very simple) crashes at the first time it achieves
the end (}) of the block < for >

------------------------------------------------------

Connection conn ("database","host","user","password");



Query query = conn.query();

query << "SELECT * FROM table ";



Result res = query.store();



if (res.size() > 0) {

cout<<"res.size(): "<<res.size()<<endl;



for (int cpt = 0; cpt < res.size(); cpt++) {

cout<<"cpt : "<<cpt<<endl;



Row row = res.at(cpt);



}

}

----------------------------------

Result of execution :



Res.size() : 6

cpt: 0



----- it crashes and doesn't display cpt: 1, cpt: 2 .. ------

It seems to be a problem of freezing memory with < row > ???



Can you help me please ???

Did it happen to anyone else ?



Nicolas Rieu.



This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. 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. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

------=_NextPart_000_02BB_01C6A5E8.9C8D27D0--



Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default RE: Problem of memory with Row ??? - 07-12-2006 , 12:37 PM







When I use valgrind, the result tells me that:

=3D=3D12093=3D=3D Invalid free() / delete / delete[]
=3D=3D12093=3D=3D at 0x1B9098CF: operator delete(void*) (vg_replace_malloc=
=2Ec:155)
=3D=3D12093=3D=3D at 0x1C0A0E58: mysqlpp::Row::~Row() (new_allocator=
=2Eh:86)
=2E=2E=2E=2E

Any suggestion ?

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


Hello all=2E

=20

The following program (very simple) crashes at the first time it achieves
the end (}) of the block < for >=20

------------------------------------------------------

Connection conn ("database","host","user","password");

=20

Query query =3D conn=2Equery();

query << "SELECT * FROM table ";

=20

Result res =3D query=2Estore();

=20

if (res=2Esize() > 0) {

cout<<"res=2Esize(): "<<res=2Esize()<<endl;

=20

for (int cpt =3D 0; cpt < res=2Esize(); cpt++) {

cout<<"cpt : "<<cpt<<endl;

=20

Row row =3D res=2Eat(cpt);

=20

}

}

----------------------------------

Result of execution :

=20

Res=2Esize() : 6

cpt: 0

=20

----- it crashes and doesn't display cpt: 1, cpt: 2 =2E=2E ------

It seems to be a problem of freezing memory with < row > ???

=20

Can you help me please ???

Did it happen to anyone else ?

=20

Nicolas Rieu=2E



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


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
  #3  
Old   
AT
 
Posts: n/a

Default Re: Problem of memory with Row ??? - 07-18-2006 , 09:20 AM



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

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

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

--
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
  #4  
Old   
AT
 
Posts: n/a

Default RE: Problem of memory with Row ??? - 07-20-2006 , 12:07 PM




Hello Warren,
I tried to launch simple1 like this:
=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


--
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
  #5  
Old   
AT
 
Posts: n/a

Default Re: Problem of memory with Row ??? - 07-21-2006 , 06:59 AM



Rieu Nicolas wrote:
Quote:
../simple1 [parameters]
I said simple2, not simple1. I don't know if that's significant, but
simple2 is a lot closer to your problem code than simple1 is.

Quote:
Well I copied the source code from simple1.cpp to my program like this:
If I understand correctly, all that has changed here is that you're
building simple1 in a different build environment? If so, and it now
breaks, you just have to hunt down the differences between the way the
two get built. It could be a difference in linkage, compiler flags,
stray libraries, etc., etc.

Also, I wasn't clear in my previous message about the test I wanted you
to make. I want you to change simple2 _in place_ and just say 'make' to
let the MySQL++ build system build the new version. If this works, then
it confirms the theory that you have a problem of build options.

--
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.