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
This commit is contained in:
Norman Feske 2013-05-03 14:44:17 +02:00
parent 0355591445
commit cc5fddb0a2
1 changed files with 9 additions and 0 deletions

View File

@ -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);
}
}