List:General Discussion« Previous MessageNext Message »
From:Benjamin Scherrey Date:April 15 1999 7:00am
Subject:Memory leaking like a sieve in mysql client api.
View as plain text  
I'm getting some unusual behavior out of the mysql client apis. Try the
following:

// test1 results in your code never returning.
void test1( void )
{
    MYSQL* mysql = mysql_init( NULL );

    mysql.close( mysql );
};

// test2 - Keeps growing memory and will not release until process ends.
Leak?
// Eventually as 'i' grows, a connection error will occur and the
routine will error out.
void test2( const char* db, const char* host, const char* user, const
char* pwd )
{
    for( int i = 0;i<3000;i++ )
    {
        MSQL* mysql = mysql_init( NULL );

        if( !mysql_real_connect( mysql, host, user, pwd, 0, NULL, 0 ) )
        {
            cout << mysql_error( mysql ) << endl;
            exit(1);
        }

        mysql_close( mysql );
    }
};

    How do I get mysql to fully release its memory without killing the
process? Why does test1 never return? This is getting a tad bit
frustrating trying to track what appears to be some undefinable behavior
in the c api. I'd appreciate any help with this.

    thanx & later,

        Ben Scherrey

Thread
Memory leaking like a sieve in mysql client api.Benjamin Scherrey15 Apr
  • Re: Memory leaking like a sieve in mysql client api.Benjamin Scherrey15 Apr
  • Re: Memory leaking like a sieve in mysql client api.Benjamin Scherrey15 Apr
  • Re: Memory leaking like a sieve in mysql client api.Benjamin Scherrey15 Apr
  • Re: Memory leaking like a sieve in mysql client api.Benjamin Scherrey15 Apr
    • Re: Memory leaking like a sieve in mysql client api.Michael Widenius15 Apr
  • Memory leaking like a sieve in mysql client api.Michael Widenius15 Apr
  • Re: Memory leaking like a sieve in mysql client api.Benjamin Scherrey15 Apr
    • Re: Memory leaking like a sieve in mysql client api.Michael Widenius16 Apr
      • Re: Memory leaking like a sieve in mysql client api..16 Apr
        • Re: Memory leaking like a sieve in mysql client api.Michael Widenius17 Apr
Re: Memory leaking like a sieve in mysql client api.Fred Lindberg15 Apr
Re: Memory leaking like a sieve in mysql client api.Fred Lindberg15 Apr