Boost logo

Boost :

Subject: Re: [boost] [thread] throw during new boost::thread() ??
From: David Abrahams (dave_at_[hidden])
Date: 2010-08-21 19:00:19

At Sat, 21 Aug 2010 14:44:04 -0700,
David M. Cotter wrote:
> if i allocate more than 5501 threads, subsequent threads fail to run.

This sounds like a really good application for a threadpool.

> these threads live a very short time and only maybe ten max are
> alive at any one time.
> for example if i'm iterating over every song in my music library and
> doing some quick process, after about 5500 songs, the program stops
> working.
> i'm exiting the threads normally, so housekeeping is performed (tho
> it would be performed anyway, right?)
> i checked and when it crashes there are indeed only about five
> threads running. so SOME resource is not getting released, it's not
> my resource, it's something to do with boost::threads.

Well, if things are *really* borked when it crashes, you might not be
getting an accurate count of the running threads, or perhaps they've
all exited by the time you actually check. No matter how quick the
task, without something to keep the number of actual simultaneous
threads under control, you *are* very likely launching all 5500 of
them at once in a way that—at best—will never perform well.

Dave Abrahams
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at