List:General Discussion« Previous MessageNext Message »
From:Greg Day Date:February 7 2004 4:31am
Subject:Re: Memory Leak using InnoDB ?
View as plain text  
Geoffrey wrote:

>Hi,
>
>I'm running MySQL 4.0.17 with RH Linux 8 on Xeon 3.0/1GB RAM.
>
>One application has to access the database (1 connection to the DB is open
>on startup and left open). However this application performs a lot of
>queries on the DB.
>
>Main InnoDB table : 50.000 Rows
>Other InnoDB tables (about 8) : From 0 to 1000 rows
>There is 1 BLOB column in the main table (longest string currently stored :
>about 500 chars)
>
>Thanks to  "top", I can see that the "used memory" is constantly increasing
>and never freed (up to 1 GB)  when performing a lot of queries.
>In fact, I can see the total memory usage increasing but the mysqld process
>memory usage remains the same.
>When the DB is not accessed, the memory usage is stable. Stopping MySQL
>server doesn't free the abnormaly allocated memory.
>
>Here is my my.cnf file :
>
>server-id=1
>socket=/tmp/mysql.sock
>innodb_data_file_path = ibdata1:750M:autoextend
>set-variable = innodb_buffer_pool_size=500M
>set-variable = innodb_additional_mem_pool_size=20M
>set-variable = innodb_log_file_size=300M
>set-variable = innodb_log_buffer_size=8M
>innodb_flush_log_at_trx_commit=0
>skip-locking
>set-variable = max_connections=5
>set-variable = read_buffer_size=1M
>set-variable = sort_buffer=1M
>set-variable = key_buffer=10M
>
>Maybe someone can share his experience to help me to understand/solve the
>problem.
>
>Regards.
>
>
>  
>
If you happen to be using the C API in the application then you need to 
make sure that mysql_free_result() is used after you are finished with 
the result set.

The manual states that mysql_free_result() "frees the memory allocated 
for a result set by |mysql_store_result()|, |mysql_use_result()|, 
|mysql_list_dbs()|, etc. When you are done with a result set, you must 
free the memory it uses by calling |mysql_free_result()|."

Not sure if other APIs or languages have a similar requirement but it 
might be worth having a look.

Hope it helps.



Thread
Memory Leak using InnoDB ?Geoffrey7 Feb
  • Re: Memory Leak using InnoDB ?Dan Nelson7 Feb
  • Re: Memory Leak using InnoDB ?Greg Day7 Feb
Re: Memory Leak using InnoDB ?Heikki Tuuri7 Feb
Re: Memory Leak using InnoDB ?Geoffrey7 Feb
Re: Memory Leak using InnoDB ?Heikki Tuuri7 Feb