Date: Mon, 6 Feb 2012 17:08:42 GMT From: Florian Wilkemeyer <fw@f-ws.de> To: freebsd-gnats-submit@FreeBSD.org Subject: amd64/164828: pthread_create/join memory leak Message-ID: <201202061708.q16H8g8r052060@red.freebsd.org> Resent-Message-ID: <201202061710.q16HA9a9045106@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 164828 >Category: amd64 >Synopsis: pthread_create/join memory leak >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-amd64 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Feb 06 17:10:09 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Florian Wilkemeyer >Release: 9.0-RELEASE >Organization: >Environment: FreeBSD 9test 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: I recently noticed that pthread_create/join leaks memory when you're going to create & destroy masses of threads. Test code: (compiled with gcc -o test test.c -lphtread) #include <pthread.h> void *thrProc(void *arg){ pthread_exit(NULL); } int main(){ pthread_t thr; while(1){ thr = NULL; pthread_create(&thr, NULL, thrProc, NULL); pthread_join(thr, NULL); } return 0; } The same code runs on 8.2 without problems: FreeBSD wilkemeyer-laptop 8.2-RELEASE-p2 FreeBSD 8.2-RELEASE-p2 #0: Thu Jul 21 20:11:49 CEST 2011 root@wilkemeyer-laptop:/usr/obj/usr/src/sys/WILKEMEYER_LAPTOP amd64 >How-To-Repeat: #include <pthread.h> void *thrProc(void *arg){ pthread_exit(NULL); } int main(){ pthread_t thr; while(1){ thr = NULL; pthread_create(&thr, NULL, thrProc, NULL); pthread_join(thr, NULL); } return 0; } // compile with // gcc -o test test.c -lphtread // >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202061708.q16H8g8r052060>