From 760e44a2f0f9dade406d1823647ef8e5ab884dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Walld=C3=A9n?= <jonasw@roxen.com> Date: Thu, 28 Jun 2018 19:21:43 +0200 Subject: [PATCH] Clear references to current job in thread farm directly after execution to avoid delayed deallocation. --- lib/modules/Thread.pmod | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/modules/Thread.pmod b/lib/modules/Thread.pmod index 915fb34566..3770e2e2db 100644 --- a/lib/modules/Thread.pmod +++ b/lib/modules/Thread.pmod @@ -556,6 +556,7 @@ optional class Farm total_time += st/1000.0; handled++; job = 0; + q = 0; if( st > max_time ) max_time = st; ft_cond->broadcast(); @@ -642,8 +643,10 @@ optional class Farm protected void dispatcher() { - while( array q = [array]job_queue->read() ) + while( array q = [array]job_queue->read() ) { aquire_thread()->run( q[1], q[0] ); + q = 0; + } if (thread_name_cb) thread_name_cb(this_thread(), 0); } -- GitLab