List:MySQL++« Previous MessageNext Message »
From:weidong shen Date:September 16 2008 1:40pm
Subject:Re: Memory will be exhausted when a minor change is made in "multiquery.cpp"
View as plain text  
Thanks for your response.  The versions I used are vs2005, mysql5.0.36 and
mysqlPP3.0.6.

Sorry that I didn't express the problem clearly. I did a test on window2003
with the below changed "multiquery.cpp", and the memory increased all the
time.
a. main()  -- add while(1){...; Sleep(10);}, and delete the test code for
stored procedure.
   // Set up query with multiple queries.
        while (1) {
            Query query = con.query();
            query << "DROP TABLE IF EXISTS test_table; " <<
                "CREATE TABLE test_table(id INT); " <<
                "INSERT INTO test_table VALUES(10); " <<
                "UPDATE test_table SET id=20 WHERE id=10; " <<
                "SELECT * FROM test_table; " <<
                "DROP TABLE test_table";
            cout << "Multi-query: " << endl << query << endl;
            // Execute statement and display all result sets.
            print_multiple_results(query);

            Sleep(10);
        }

//#if MYSQL_VERSION_ID >= 50000
//  // If it's MySQL v5.0 or higher, also test stored procedures, which
//  // return their results the same way multi-queries do.
//  query << "DROP PROCEDURE IF EXISTS get_stock; " <<
//    "CREATE PROCEDURE get_stock" <<
//    "( i_item varchar(20) ) " <<
//    "BEGIN " <<
//    "SET i_item = concat('%', i_item, '%'); " <<
//    "SELECT * FROM stock WHERE lower(item) like lower(i_item); " <<
//    "END;";
//  cout << "Stored procedure query: " << endl << query << endl;
//
//  // Create the stored procedure.
//  print_multiple_results(query);
//
//  // Call the stored procedure and display its results.
//  query << "CALL get_stock('relish')";
//  cout << "Query: " << query << endl;
//  print_multiple_results(query);
//#endif

b. print_row()

 static void
print_row(IntVectorType& widths, Row& row)
{
 cout << "  |" << setfill(' ');
 for (size_t i = 0; i < row.size(); ++i) {
     mysqlpp::sql_bigint tmp = row[i];           // add this
instruction caused memory increasing.
                                                               // and the
memory will be stable if we detele this one.
     cout << " " << setw(widths.at(i)) << row[i] << " |";
 }
 cout << endl;
}


2008/9/16 Warren Young <mysqlpp@stripped>

> Please keep responses on the mailing list.  Re-send your message there.
>

Thread
Memory will be exhausted when a minor change is made in "multiquery.cpp"weidong shen12 Sep
  • Re: Memory will be exhausted when a minor change is made in "multiquery.cpp"Warren Young13 Sep
Re: Memory will be exhausted when a minor change is made in "multiquery.cpp"weidong shen16 Sep
  • Re: Memory will be exhausted when a minor change is made in "multiquery.cpp"weidong shen16 Sep
  • Re: Memory will be exhausted when a minor change is made in "multiquery.cpp"Warren Young17 Sep