From owner-freebsd-questions@FreeBSD.ORG Wed May 20 18:56:29 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E9CA106564A for ; Wed, 20 May 2009 18:56:29 +0000 (UTC) (envelope-from psteele@maxiscale.com) Received: from exprod7og118.obsmtp.com (exprod7og118.obsmtp.com [64.18.2.8]) by mx1.freebsd.org (Postfix) with SMTP id E4C138FC15 for ; Wed, 20 May 2009 18:56:28 +0000 (UTC) (envelope-from psteele@maxiscale.com) Received: from source ([209.85.146.179]) by exprod7ob118.postini.com ([64.18.6.12]) with SMTP ID DSNKShRSXMNCFdfDs7l0Yfx7jodDXPXAv/kx@postini.com; Wed, 20 May 2009 11:56:29 PDT Received: by wa-out-1112.google.com with SMTP id j4so106344wah.23 for ; Wed, 20 May 2009 11:56:28 -0700 (PDT) Received: by 10.114.157.11 with SMTP id f11mr3249244wae.75.1242845788323; Wed, 20 May 2009 11:56:28 -0700 (PDT) Received: from localhost ([76.231.178.131]) by mx.google.com with ESMTPS id j31sm3635657waf.61.2009.05.20.11.56.26 (version=SSLv3 cipher=RC4-MD5); Wed, 20 May 2009 11:56:27 -0700 (PDT) Date: Wed, 20 May 2009 11:56:24 -0700 (PDT) From: Peter Steele To: #freebsd-questions Message-ID: <19206470.1651242845780966.JavaMail.HALO$@halo> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: pthread_detach doesn't release memory X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2009 18:56:29 -0000 I create a thread using something like this: pthread_t thread; pthread_create(&thread, NULL, mythread, NULL); pthread_detach(thread); I use the detach because I want to make sure the thread's resource are reclaimed when the thread completes. However, this does not seem to work. Each time I create a thread the application's memory footprint grows by 128 bytes and this memory is never released. Am I doing this right?