celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Broekhuis (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CELIX-219) Memory Leaks
Date Wed, 11 Feb 2015 10:21:12 GMT

    [ https://issues.apache.org/jira/browse/CELIX-219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14315953#comment-14315953
] 

Alexander Broekhuis commented on CELIX-219:
-------------------------------------------

Did some more inspection, and the uninstall is not needed. In "framework_destroy" the installedBundleMap
is iterated and all bundles in there are destroyed. It, however, does not remove the entries
from the installed map. So the map is left, which means the values in there are invalid (freed)
pointers. Since no one uses them after that point, this has never resulted in problems. I'll
update this part of the code to remove the bundle from the map when done.
It also does not close any open libraries, which is actually a regression introduced when
loading libraries was moved to the install, instead of the start. This needs to be added to
the framework_destroy as well.

> Memory Leaks
> ------------
>
>                 Key: CELIX-219
>                 URL: https://issues.apache.org/jira/browse/CELIX-219
>             Project: Celix
>          Issue Type: Bug
>            Reporter: Daniel Parker
>            Priority: Minor
>
> framework.c:
>    framework_create() allocates memory for logger, but framework_destroy does not free()
it.
>    framework_destroy() when destroying framework->installedBundleMap should set the
second argument to true in order to free the memory allocated for the keys.
>    framework_destroy() should destroy the mutexes/conditions created by framework_create().
>    framework_loadLibrary() should clear the entire libraryPath string before using it.
>    fw_uninstallBundle() should only call fw_stopBundle() if the bundle is in the OSGI_FRAMEWORK_BUNDLE_ACTIVE
state.
>    The proxy/endpoint bundles get uninstalled correctly, but the normal bundles do not
get uninstalled.  This might be resolved by letting framework_shutdown() call fw_uninstallBundle()
for every bundle (except for the system framework bundle) in the installedBundleMap after
it's done stopping all of the bundles.  Alternately, the bundles could be uninstalled in framework_destroy(),
but fw_uninstallBundle() (and bundle_uninstall() ) wouldn't work at this point because the
dispatcherThread would already have been canceled.
> bundle.c:
>    The function bundle_addModule() does not have a corresponding bundle_removeModule().
 This is because modules are added one at a time but removed all at once.  However, the code
which remove the modules in bundle_destroy() needs to call resolver_removeModule() in order
for this to work properly.
>    The function bundle_isUsed() looks incorrect/incomplete in how it uses module_getDependents().
 However, the function isn't actually used so it's probably easier to just remove it than
to try to fix it.
>    bundle_closeModules() looks like it should be calling module_destroy() rather than
module_setWires().  And it looks like it should call arrayList_clear(bundle->modules) when
it's done.
> resolver.c:
>    m_modules is created but never destroyed.  Perhaps it could be destroyed whenever
it's empty?
>    m_unresolvedServices/m_resolvedServices are never destroyed and none of the elements
added to them are ever destroyed either.  Perhaps each element should be destroyed if they
become empty and m_unresolvedServices/m_resolvedServices should be destroyed once it contains
no elements?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message