diff --git a/server/job-workers/job-worker-server.cpp b/server/job-workers/job-worker-server.cpp index f17bc3ae16..88bd32e33c 100644 --- a/server/job-workers/job-worker-server.cpp +++ b/server/job-workers/job-worker-server.cpp @@ -72,7 +72,7 @@ int jobs_server_php_wakeup(connection *c) { double timeout = worker->enter_lifecycle(); if (timeout == 0) { - delete worker; + worker->~PhpWorker(); jobs_server_at_query_end(c); } else { assert(c->pending_queries >= 0 && c->status == conn_wait_net); diff --git a/server/php-engine.cpp b/server/php-engine.cpp index 0364888be9..5b82634657 100644 --- a/server/php-engine.cpp +++ b/server/php-engine.cpp @@ -526,7 +526,7 @@ int do_hts_func_wakeup(connection *c, bool flag) { assert(worker); double timeout = worker->enter_lifecycle(); if (timeout == 0) { - delete worker; + worker->~PhpWorker(); hts_at_query_end(c, flag); } else { assert (timeout > 0); @@ -641,7 +641,7 @@ int hts_func_close(connection *c, int who __attribute__((unused))) { double timeout = worker->enter_lifecycle(); D->extra = nullptr; assert ("worker is unfinished after closing connection" && timeout == 0); - delete worker; + worker->~PhpWorker(); } return 0; } @@ -826,7 +826,7 @@ int rpcx_func_wakeup(connection *c) { assert(worker); double timeout = worker->enter_lifecycle(); if (timeout == 0) { - delete worker; + worker->~PhpWorker(); rpcx_at_query_end(c); } else { assert (c->pending_queries >= 0 && c->status == conn_wait_net); @@ -845,7 +845,7 @@ int rpcx_func_close(connection *c, int who __attribute__((unused))) { double timeout = worker->enter_lifecycle(); D->extra = nullptr; assert ("worker is unfinished after closing connection" && timeout == 0); - delete worker; + worker->~PhpWorker(); if (!has_pending_scripts()) { lease_set_ready(); diff --git a/server/php-worker.cpp b/server/php-worker.cpp index c7c604ca95..a66b771acb 100644 --- a/server/php-worker.cpp +++ b/server/php-worker.cpp @@ -419,7 +419,7 @@ void PhpWorker::state_free_script() noexcept { static int finished_queries = 0; if ((++finished_queries) % queries_to_recreate_script == 0 || (!use_madvise_dontneed && php_script->memory_get_total_usage() > memory_used_to_recreate_script)) { - delete php_script; + php_script->~PhpScript(); php_script = nullptr; finished_queries = 0; }