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] [Comment Edited] (CELIX-219) Memory Leaks
Date Wed, 11 Feb 2015 08:40:12 GMT

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

Alexander Broekhuis edited comment on CELIX-219 at 2/11/15 8:39 AM:
--------------------------------------------------------------------

Thanks for those reports, I'll go through them file by file, starting with the framework;
logger: no specific remarks, needs to be fixed
installedBundleMap: The key is already free'd, the values should not be free'd as those need
to be removed from the map during shutdown of the framework. See the uninstall for more details.
mutexes/conditions: needs to be fixed
loadLibrary: needs to be fixed
uninstall: This one is a bit more tricky, though probably not even that hard to fix. The issue
is that during shutdown, active bundles should not be marked as "uninstalled", this of course
does not mean that it's resources should not be cleaned. So I'm going to look at the shutdown
thread, and see if I can add something there. Probably have to add a flag to the uninstall
function so that it does not record the state (similar to what stop already does).


was (Author: abroekhuis):
Thanks for those reports, I'll go through time file by file, starting with the framework;
logger: no specific remarks, needs to be fixed
installedBundleMap: The key is already free'd, the values should not be free'd as those need
to be removed from the map during shutdown of the framework. See the uninstall for more details.
mutexes/conditions: needs to be fixed
loadLibrary: needs to be fixed
uninstall: This one is a bit more tricky, though probably not even that hard to fix. The issue
is that during shutdown, active bundles should not be marked as "uninstalled", this of course
does not mean that it's resources should not be cleaned. So I'm going to look at the shutdown
thread, and see if I can add something there. Probably have to add a flag to the uninstall
function so that it does not record the state (similar to what stop already does).

> 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