From cc5fddb0a2c95b7737636bd8c7766c5384a0a462 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 3 May 2013 14:44:17 +0200 Subject: [PATCH] Loader: Free entries of parent-service registry The parent-service registry is populated on demand by the 'Loader::Child' whenever a prior unknown service is requested. Since the number of parent services is limited, we expect the registry to settle after a while. However, each loader session has a private instance of a parent-service registry. So when creating and destroying loader sessions, parent registries will be populated again and again. We have to make sure to discard the entries along with the destruction of a loader session to avoid the leakage of memory. Issue #717 --- os/src/server/loader/main.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/os/src/server/loader/main.cc b/os/src/server/loader/main.cc index b3061052cf..195032d233 100644 --- a/os/src/server/loader/main.cc +++ b/os/src/server/loader/main.cc @@ -260,6 +260,15 @@ namespace Loader { { if (_child) destroy(&_md_alloc, _child); + + /* + * The parent-service registry is populated by the 'Child' + * on demand. Revert those allocations. + */ + while (Service *service = _parent_services.find_by_server(0)) { + _parent_services.remove(service); + destroy(env()->heap(), service); + } }