Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-3564

Memory leak in Filterindex / ServiceRegistryCache

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • dependencymanager-3.0.0
    • None
    • Dependency Manager
    • Linux Mint 12, x64, Dell E6520

    Description

      The filter indexes in the ServiceRegistryCache caches ServiceListeners for a faster lookup.
      However, once a ServiceListener is stored in the cache, it will never be released which will eventually lead to an OutOfMemoryError.

      This is caused by the implementation of BundleContextIntercepter#removeServiceListener.
      While debugging, it appears the cache has no filterindex for arguments null,null and thus leaving the listener in the cache.

      Attachments

        Activity

          Fixed by a rather brute force call to FilterIndex.removeListener() for two reasons:

          • It aligns nicely with the BundleContext.removeListener() API which promises to do nothing when a listener is passed that is not available in this bundleContext;
          • Another solution would be to explicitly keep track in the ServiceRegistryCache of what listener is registered with which FilterIndex, It's cheaper in memory consumption to have the indices perform an unnecessary map.remove(). The extra processing overhead is negligible.
          uiterlix Xander Uiterlinden added a comment - Fixed by a rather brute force call to FilterIndex.removeListener() for two reasons: It aligns nicely with the BundleContext.removeListener() API which promises to do nothing when a listener is passed that is not available in this bundleContext; Another solution would be to explicitly keep track in the ServiceRegistryCache of what listener is registered with which FilterIndex, It's cheaper in memory consumption to have the indices perform an unnecessary map.remove(). The extra processing overhead is negligible.

          See comment.

          uiterlix Xander Uiterlinden added a comment - See comment.

          People

            uiterlix Xander Uiterlinden
            janhoeve Jan Hoeve
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: