List:MySQL++« Previous MessageNext Message »
From:Rieu Nicolas Date:September 14 2006 6:35am
Subject:SOLVED: Problem of memory with Row ???
View as plain text  
Hello.
Firstable, thanks for your help, this mailing list is very great because
it's rare to find other information elsewhere.

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

In fact, the library mysql++ was compiled with gcc 3.4, but all the source
code and other librairies were compiled in gcc 4.0, but we noticed this kind
of incompatibility only yesterday.

So we compiled mysql++ with gcc4.0 and it's ok.

Stupid thing, but not easy to find out.

Nicolas

-----Message d'origine-----
De : Rieu Nicolas [mailto:nicolas.rieu@stripped] 
Envoyé : jeudi 20 juillet 2006 19:05
À : plusplus@stripped
Objet : RE: Problem of memory with Row ???


Hello Warren,
I tried to launch simple1 like this:
.../simple1 [parameters]

It's ok

Well I copied the source code from simple1.cpp to my program like this:

        // Retrieve the sample stock table set up by resetdb
        mysqlpp::Query query = con.query();
        query << "select * from stock";
        mysqlpp::Result res = query.store();

        // Display results
        if (res) {
                // Display header
                cout.setf(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 = 0; row = res.at(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.error()
<<
endl;
                return 1;
        }


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

valgrind tells me that:

Invalid free() / delete / delete[]
operator delete(void*) (vg_replace_malloc.c:155)
mysqlpp::Row::~Row() new_allocator.h:86)

the features of my build environment:
compiler: gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)
OS: Red Hat Enterprise Linux ES release 4 (Nahant Update 2) Kernel
2.6.9-34.0.1.ELsmp on an i686
MySQL++: 2.1.1
Mysql 5.0

Do you want more information ?

Nicolas

-----Message d'origine-----
De : Warren Young [mailto:mysqlpp@stripped] 
Envoyé : mardi 18 juillet 2006 16:19
À : MySQL++ Mailing List
Objet : Re: Problem of memory with Row ???

Rieu Nicolas wrote:
> 
> 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?unsub=1



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.


-- 
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    http://lists.mysql.com/plusplus?unsub=1


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.

Thread
Problem of memory with Row ???Rieu Nicolas12 Jul
  • RE: Problem of memory with Row ???Rieu Nicolas12 Jul
  • Re: Problem of memory with Row ???Warren Young18 Jul
    • RE: Problem of memory with Row ???Rieu Nicolas20 Jul
      • Re: Problem of memory with Row ???Warren Young21 Jul
      • SOLVED: Problem of memory with Row ???Rieu Nicolas14 Sep