Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Feb 2014 10:53:03 -0500
From:      Ed Maste <emaste@freebsd.org>
To:        Erich Dollansky <erichsfreebsdlist@alogt.com>
Cc:        freebsd-hackers@freebsd.org, freebsd-threads@freebsd.org
Subject:   Re: pthread programming eats up resources (My or FreeBSD's fault?)
Message-ID:  <CAPyFy2BqC-5NhJVwsbGHUQjDL_gjz=PHhymH24nqgNOZ-c7RzQ@mail.gmail.com>
In-Reply-To: <20140219230824.0f2ba24b@X220.alogt.com>
References:  <20140218180646.GA67861@schlappy> <20140219144728.GA3036@schlappy> <20140219230824.0f2ba24b@X220.alogt.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 19 February 2014 10:08, Erich Dollansky <erichsfreebsdlist@alogt.com> wrote:
> Hi,
>
> as I understand your program, it creates 1000 threads, waits a but and
> then starts again creating 1000 threads until something kill it.
>
> From my point of view, your program depends very much on the default
> settings of the environment. If the environment allows the immediate
> execution of the new thread, you will never get many threads.
> Otherwise, the number of threads hanging around could add up. It also
> depends on the number of CPUs/cores your system has.

> But your are right, it should not crash on a modern machine but it
> still could use some amount of memory.

Andre's second example program demonstrates the problem as well.  It
calls pthread_join() for each of the created threads, so should not be
able to leave them around.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPyFy2BqC-5NhJVwsbGHUQjDL_gjz=PHhymH24nqgNOZ-c7RzQ>