From owner-freebsd-stable@FreeBSD.ORG Thu Sep 29 14:06:10 2005 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EAB1216A41F; Thu, 29 Sep 2005 14:06:10 +0000 (GMT) (envelope-from lefty@ene.asda.gr) Received: from mx3.asda.gr (ene.asda.gr [193.92.118.161]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0BA3543D48; Thu, 29 Sep 2005 14:06:09 +0000 (GMT) (envelope-from lefty@ene.asda.gr) Received: by mx3.asda.gr (Postfix, from userid 58) id 8DD071146F; Thu, 29 Sep 2005 17:06:08 +0300 (EEST) X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on ene.asda.gr X-Spam-Level: X-Spam-Status: score=-103.8 autolearn=ham tests=ALL_TRUSTED,AWL,BAYES_00, USER_IN_WHITELIST Received: from [193.92.118.162] (lefty.ene.asda.gr [193.92.118.162]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Lefteris Tsintjelis", Issuer "ASDA Root CA" (verified OK)) by mx3.asda.gr (Postfix) with ESMTP id 5D49A1142D; Thu, 29 Sep 2005 17:05:46 +0300 (EEST) Message-ID: <433BF441.80404@ene.asda.gr> Date: Thu, 29 Sep 2005 17:03:45 +0300 From: Lefteris Tsintjelis Organization: ASDA User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Simon Barner References: <433BB81A.5090602@ene.asda.gr> <20050929133156.GA72022@zi025.glhnet.mhn.de> In-Reply-To: <20050929133156.GA72022@zi025.glhnet.mhn.de> Content-Type: text/plain; charset=ISO-8859-7; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-stable@freebsd.org Subject: Re: pthread_key_create memory leakage in pthreads? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 14:06:11 -0000 Simon Barner wrote: > > Can you provide a (minimal) example where this happens? Also, what is > the exact command line? valgrind --trace-children=yes --leak-check=yes --show-reachable=yes ./sql-m ==12024== Memcheck, a memory error detector for x86-linux. ==12024== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward. ==12024== Using valgrind-2.1.0, a program supervision framework for x86-linux. ==12024== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward. ==12024== Estimated CPU clock rate is 3089 MHz ==12024== For more details, rerun with: -v ==12024== ==12024== warning: Valgrind's pthread_cond_destroy is incomplete ==12024== (it doesn't check if the cond is waited on) ==12024== your program may misbehave as a result ==12024== warning: Valgrind's pthread_cond_destroy is incomplete ==12024== (it doesn't check if the cond is waited on) ==12024== your program may misbehave as a result ==12024== ==12024== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==12024== malloc/free: in use at exit: 33100 bytes in 22 blocks. ==12024== malloc/free: 6051 allocs, 6029 frees, 24774738 bytes allocated. ==12024== For counts of detected errors, rerun with: -v ==12024== searching for pointers to 22 not-freed blocks. ==12024== checked 2119764 bytes. ==12024== ==12024== 52 bytes in 1 blocks are still reachable in loss record 1 of 5 ==12024== at 0x3C036967: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so) ==12024== by 0x3C050F6C: my_thread_init (in /usr/local/lib/mysql/libmysqlclient_r.so.14) ==12024== by 0x3C050E4A: my_thread_global_init (in /usr/local/lib/mysql/libmysqlclient_r.so.14) ==12024== by 0x3C04C158: my_init (in /usr/local/lib/mysql/libmysqlclient_r.so.14) ==12024== ==12024== ==12024== 136 bytes in 12 blocks are still reachable in loss record 2 of 5 ==12024== at 0x3C03619F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so) ==12024== by 0x3C0978EC: (within /usr/local/lib/valgrind/libpthread.so.1) ==12024== by 0x3C098F65: pthread_mutex_init (in /usr/local/lib/valgrind/libpthread.so.1) ==12024== by 0x3C050D95: my_thread_global_init (in /usr/local/lib/mysql/libmysqlclient_r.so.14) ==12024== ==12024== ==12024== 200 bytes in 1 blocks are definitely lost in loss record 3 of 5 ==12024== at 0x3C03619F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so) ==12024== by 0x3C0978EC: (within /usr/local/lib/valgrind/libpthread.so.1) ==12024== by 0x3C09A2FD: (within /usr/local/lib/valgrind/libpthread.so.1) ==12024== by 0x3C09A489: pthread_key_create (in /usr/local/lib/valgrind/libpthread.so.1) ==12024== ==12024== ==12024== 4096 bytes in 1 blocks are still reachable in loss record 4 of 5 ==12024== at 0x3C03619F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so) ==12024== by 0x3C17B4B9: __smakebuf (in /lib/libc.so.5) ==12024== by 0x3C17B416: __swsetup (in /lib/libc.so.5) ==12024== by 0x3C16FC39: __vfprintf (in /lib/libc.so.5) ==12024== ==12024== ==12024== 28616 bytes in 7 blocks are still reachable in loss record 5 of 5 ==12024== at 0x3C03619F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so) ==12024== by 0x3C05308A: my_once_alloc (in /usr/local/lib/mysql/libmysqlclient_r.so.14) ==12024== by 0x3C0534B7: init_state_maps (in /usr/local/lib/mysql/libmysqlclient_r.so.14) ==12024== by 0x3C053E94: init_available_charsets (in /usr/local/lib/mysql/libmysqlclient_r.so.14) ==12024== ==12024== LEAK SUMMARY: ==12024== definitely lost: 200 bytes in 1 blocks. ==12024== possibly lost: 0 bytes in 0 blocks. ==12024== still reachable: 32900 bytes in 21 blocks. ==12024== suppressed: 0 bytes in 0 blocks. valgrind is not a native BSD program. I use it to detect program memory leaks. However, I am not sure if in this case, is detecting its own leaks and problems or not. It is refering to its own /usr/local/lib/valgrind/\ libpthread.so.1. sql-m is my own program that I test but I have double checked everything and this shouldn't happen. If you need further info about the sql-m please let me know and I will send you a copy but its a very simple threaded one.