11 messages in com.mysql.lists.bugsRE: Memory leak in client-library's m...
FromSent OnAttachments
Mikko Noromaa09 May 2002 10:54 
Sinisa Milivojevic10 May 2002 05:16 
Mikko Noromaa10 May 2002 07:22 
Sinisa Milivojevic10 May 2002 09:08 
Mikko Noromaa10 May 2002 09:51 
Sinisa Milivojevic10 May 2002 09:57 
Sinisa Milivojevic10 May 2002 10:08 
Venu10 May 2002 15:11 
Mikko Noromaa11 May 2002 08:06 
Michael Widenius15 May 2002 01:11 
Michael Widenius15 May 2002 01:45 
Subject:RE: Memory leak in client-library's mysql_init() and mysql_real_connect()
From:Michael Widenius (mon@mysql.com)
Date:05/15/2002 01:11:43 AM
List:com.mysql.lists.bugs

Hi!

"Mikko" == Mikko Noromaa <mik@nm-sol.com> writes:

Mikko> Hi, Mikko> Thanks for your reply.

Mikko> The leaks are not OS sockets or Windows handles. The non-freed objects Mikko> are allocated through the following call-chains:

Mikko> mysql_init(), libmysql.c line 1008 -> mysql_once_init(), libmysql.c line 1040 -> my_init(), my_init.c line 85 -> my_thread_global_init(), my_thr_init.c line 82 -> my_thread_init(), my_thr_init.c line 121 -> calloc()

The above memory allocation is ok; MySQL will keep the above memory allocated until the client calls mysql_thread_end().

Mikko> mysql_real_connect(), libmysql.c line 1418 -> get_charset(), charset.c line 380 -> init_available_charsets(), charset.c line 191 -> init_dynamic_array(), array.c line 49 -> my_malloc(), safemalloc.c line 144 -> malloc()

The above variable is allocated once and is freed if you call mysql_server_end(). This functions should only be called once before your application ends.

Mikko> In addition, when running the debug build of libmysql, several blocks Mikko> allocated by DbugMalloc() are not freed. For example in PushState() and Mikko> code_state().

These are freed by the above mentioned end functions.

Sorry, but these are not leaks but memory needed by MySQL for the lifetime of the thread/process.

Regards, Monty