Use ForkJoinPool and provide builder API to limit threads count.#1092
Use ForkJoinPool and provide builder API to limit threads count.#1092mstyura wants to merge 1 commit intoobjectbox:mainfrom
Conversation
|
Thanks! Maybe we should also consider setting the maximum size to 64 (but at least number of processors) by default. (It's the default parallelism number for Kotlin's IO scheduler.) |
9f2b3e8 to
6865c52
Compare
|
Hi! I like the idea of having sane default limit to number of threads in pool. |
|
@mstyura Oh sorry, I didn't mean for you to implement this. With "we" I meant the ObjectBox team. But thanks for the investigation! |
This PR provide API to configure thread pool limits use by
BoxStore.I was observed situation in
Androidapplication where (due to some other issues in app) application is crashed withOOM. At the moment of crash there were tens of alive threads belong toObjectBoxpool. The numbering suggest that thousands of thread were already created and destroyed by the pool at the moment of crash.So it would be nice to have an API to limit number of threads allowed in thread pool and minimum number of threads as well.
This of course will not solve original problem with app I was debugging, but will probably help to reveal root problem earlier.