limit max number of threads

determine hardware limitation. too many threads may result in memory
issue (not leak)