optimize for making valgrind happy

This commit is contained in:
zhengshuxin 2022-07-18 11:42:25 +08:00
parent 29e43b1d6f
commit 14fce1cc1a
3 changed files with 16 additions and 3 deletions

View File

@ -50,8 +50,6 @@ master_service::master_service(void)
master_service::~master_service(void) master_service::~master_service(void)
{ {
delete conf_;
delete service_;
} }
http_service& master_service::get_service(void) const http_service& master_service::get_service(void) const
@ -185,6 +183,9 @@ void master_service::proc_on_init(void)
void master_service::proc_on_exit(void) void master_service::proc_on_exit(void)
{ {
logger(">>>proc_on_exit<<<"); logger(">>>proc_on_exit<<<");
delete conf_;
delete service_;
} }
bool master_service::proc_on_sighup(acl::string&) bool master_service::proc_on_sighup(acl::string&)

View File

@ -275,6 +275,8 @@ static void main_server_exit(ACL_FIBER *fiber, int status)
/* stop the main thread fiber schedule proccess */ /* stop the main thread fiber schedule proccess */
acl_fiber_schedule_stop(); acl_fiber_schedule_stop();
acl_app_conf_unload();
acl_debug_end();
__exit_status = status; __exit_status = status;
} }
@ -639,8 +641,9 @@ static void main_thread_loop(void)
acl_close_on_exec(ACL_MASTER_STATUS_FD, ACL_CLOSE_ON_EXEC); acl_close_on_exec(ACL_MASTER_STATUS_FD, ACL_CLOSE_ON_EXEC);
acl_close_on_exec(ACL_MASTER_FLOW_READ, ACL_CLOSE_ON_EXEC); acl_close_on_exec(ACL_MASTER_FLOW_READ, ACL_CLOSE_ON_EXEC);
acl_close_on_exec(ACL_MASTER_FLOW_WRITE, ACL_CLOSE_ON_EXEC); acl_close_on_exec(ACL_MASTER_FLOW_WRITE, ACL_CLOSE_ON_EXEC);
if (acl_var_fiber_dispatch_addr && *acl_var_fiber_dispatch_addr) if (acl_var_fiber_dispatch_addr && *acl_var_fiber_dispatch_addr) {
acl_fiber_create(main_fiber_dispatch, NULL, STACK_SIZE); acl_fiber_create(main_fiber_dispatch, NULL, STACK_SIZE);
}
} }
#endif #endif

View File

@ -91,6 +91,15 @@ void master_fiber::service_exit(void* ctx)
master_fiber* mf = (master_fiber *) ctx; master_fiber* mf = (master_fiber *) ctx;
acl_assert(mf != NULL); acl_assert(mf != NULL);
mf->proc_on_exit(); mf->proc_on_exit();
for (std::vector<server_socket*>::iterator it = mf->servers_.begin();
it != mf->servers_.end(); ++it) {
(*it)->unbind();
delete *it;
}
mf->conf_.reset();
acl::log::close();
} }
void master_fiber::service_on_listen(void* ctx, ACL_VSTREAM* sstream) void master_fiber::service_on_listen(void* ctx, ACL_VSTREAM* sstream)