Bug #14903 memory block lost in the innodb handler
Submitted: 12 Nov 2005 22:58 Modified: 13 Nov 2005 16:29
Reporter: Oleksandr Byelkin Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.0.17 OS:Linux (linux)
Assigned to: CPU Architecture:Any

[12 Nov 2005 22:58] Oleksandr Byelkin
There are a lot of following message from valgrind:
==2237== 8160 bytes in 1 blocks are definitely lost in loss record 3 of 3
==2237==    at 0x1B901AB8: malloc (vg_replace_malloc.c:130)
==2237==    by 0x1BA8AA9E: __pthread_initialize_manager (in /lib/libpthread-0.10.so)
==2237==    by 0x1BA8AF1A: pthread_create@@GLIBC_2.1 (in /lib/libpthread-0.10.so)
==2237==    by 0x842329E: os_thread_create (os0thread.c:158)
==2237==    by 0x839C58C: innobase_start_or_create_for_mysql (srv0start.c:1240)
==2237==    by 0x8279ECF: innobase_init() (ha_innodb.cc:1392)
==2237==    by 0x8266840: ha_init() (handler.cc:467)
==2237==    by 0x81A392F: init_server_components() (mysqld.cc:3032)
==2237==    by 0x81A3E02: main (mysqld.cc:3353)

How to repeat:
1) build last 5.0.17 with valgrind support,
2) run tests with valgrind, for example:
./mysql-test-run --valgrind auto_increment
full list of failed test can be seen in master.err attached to the report.
[13 Nov 2005 16:29] Heikki Tuuri
Hmm... it may be that also someone else reported a memory leak in pthread_create(). But I do not think it occurs on all platforms.

When looking at srv0start.c, we see that the call os_thread_create() on that particular line 1240 passes a parameter to the function that is called first after the thread has been created. Other calls in that file pass NULL. Could it be that __pthread_initialize_manager in such case indeed leaks 8160 bytes?

The parameter itself is not leaked, it is simply an integer stored in static memory.

==3025==    at 0x1B901AB8: malloc (vg_replace_malloc.c:130)
==3025==    by 0x1BA8AA9E: __pthread_initialize_manager (in /lib/libpthread-0.10.so)
==3025==    by 0x1BA8AF1A: pthread_create@@GLIBC_2.1 (in /lib/libpthread-0.10.so)

I do not think we need to care about this Valgrind warning. I am closing this bug report.