ここや他のサイトで多くの投稿を読みましたが、エラーを作成する問題を見つけることができません:
実行の前後に UI スレッドを簡単に操作したいので、AsyncTask を使用します。
doInBackground で ThreadPoolExecutor を作成し、Runnables を実行します。
Executor で Runnable を 1 つしか実行しない場合は問題ありませんが、別の Runnable を実行すると次のエラーが発生します。
06-26 18:00:42.288: A/libc(25073): Fatal signal 11 (SIGSEGV) at 0x7f486162 (code=1), thread 25106 (pool-1-thread-2)
06-26 18:00:42.304: D/dalvikvm(25073): GC_CONCURRENT freed 119K, 2% free 8908K/9056K, paused 4ms+4ms, total 45ms
06-26 18:00:42.327: I/System.out(25073): In Check All with Prefix: a and Length: 4
06-26 18:00:42.390: I/DEBUG(126): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-26 18:00:42.390: I/DEBUG(126): Build fingerprint: 'google/yakju/maguro:4.2.2/JDQ39/573038:user/release-keys'
06-26 18:00:42.390: I/DEBUG(126): Revision: '9'
06-26 18:00:42.390: I/DEBUG(126): pid: 25073, tid: 25106, name: pool-1-thread-2 >>> de.uni_duesseldorf.cn.distributed_computing2 <<<
06-26 18:00:42.390: I/DEBUG(126): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 7f486162
...
06-26 18:00:42.538: I/DEBUG(126): memory map around fault addr 7f486162:
06-26 18:00:42.538: I/DEBUG(126): 60292000-60391000
06-26 18:00:42.538: I/DEBUG(126): (no map for address)
06-26 18:00:42.538: I/DEBUG(126): bed14000-bed35000 [stack]
ThreadPoolExecutor を次のように設定しました。
// numberOfPackages: Number of Runnables to be executed
public void initializeThreadPoolExecutor (int numberOfPackages)
{
int corePoolSize = Runtime.getRuntime().availableProcessors();
int maxPoolSize = numberOfPackages;
long keepAliveTime = 60;
final BlockingQueue workingQueue = new LinkedBlockingQueue();
executor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.SECONDS, workingQueue);
}
2番目のスレッドを開始するときに失敗する理由はわかりません。
もしかしてメモリーリーク?
任意のヘルプをいただければ幸いです。
前もって感謝します