List:MySQL++« Previous MessageNext Message »
From:weidong shen Date:December 16 2008 5:39am
Subject:memory will increase all the time in a simple example
View as plain text  
Hi Warren Young:

Below is a simple example I wrote. The problem is that the memory will
increase all the time when executing "mysqlpp::sql_int id = obRow[0]". But
the memory will be stable when only executing this instruction "cout <<
obRow[0]".

Would you please help me find out the reason?  Thanks you in advance!

int main(int argc, char *argv[])
{
    // Get connection parameters from command line
    const char* db = "testdb", *server = "192.168.1.5", *user = "root",
*pass = "111111";

    try {
        Connection con;
        con.set_option(new MultiStatementsOption(true));
        if (!con.connect(db, server, user, pass)) {
               return 1;
        }

        while (1) {
            Query query = con.query();
            query  << "SELECT  COUNT(*) FROM dp_npc;";
            StoreQueryResult res = query.store();
            mysqlpp::Row &obRow = res[0];

            cout << obRow[0];                         // the memory is
statble.
            mysqlpp::sql_int id = obRow[0];   // the memory will be
increasing all the time when to execute this instruction.

            for (int i = 1; query.more_results(); ++i) {
                res = query.store_next();
            }
            Sleep(10);
    }

    // ....
}

Thread
memory will increase all the time in a simple exampleweidong shen16 Dec
  • Re: memory will increase all the time in a simple exampleweidong shen16 Dec
  • Re: memory will increase all the time in a simple exampleMickaël Wolff16 Dec
    • Re: memory will increase all the time in a simple exampleweidong shen16 Dec
      • Re: memory will increase all the time in a simple exampleMickaël Wolff16 Dec
        • Re: memory will increase all the time in a simple exampleweidong shen16 Dec
  • Re: memory will increase all the time in a simple exampleWarren Young16 Dec