when i invoke threadExecutor method large number
fun startAnimation(): Unit {
sPool.scheduleAtFixedRate(taskQu, 0, 1000, TimeUnit.MILLISECONDS)
}
it will cause this error prompt , sPool
is java ThreadExecutors
val sPool = Executors.newScheduledThreadPool(2)!!
and taskQu
is async timer task
val taskQu = object : TimerTask() {
override fun run() {
uihandler.obtainMessage().sendToTarget()
}
}
i got this prompt
java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
at java.lang.Thread.nativeCreate(Native Method)
at java.lang.Thread.start(Thread.java:1063)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:921)
at java.util.concurrent.ThreadPoolExecutor.ensurePrestart(ThreadPoolExecutor.java:1556)
at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:310)
at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(ScheduledThreadPoolExecutor.java:567)
so , where this problem about this issue emerge?