List:MySQL++« Previous MessageNext Message »
From:Rieu Nicolas Date:July 20 2006 5:05pm
Subject:RE: Problem of memory with Row ???
View as plain text  
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 =;

        // Display results
        if (res) {
                // Display header
                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];
                mysqlpp::Row row;
                mysqlpp::Row::size_type i;
                for (i = 0; row =; ++i) {
                        cout << setw(20) <<
                                        row["item"] << ' ' <<
                                        setw(9) << row["num"] << ' ' <<
                                        setw(9) << row["weight"] << ' '
                                        setw(9) << row["price"] << ' '
                                        setw(9) << row["sdate"] <<
        else {
                cerr << "Failed to get stock table: " << query.error()
                return 1;

And I've got the same problem: 
it crashes at the line " for (i = 0; row =; ++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 ?


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

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:
To unsubscribe:

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.

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