eclipse-sisu / sisu-project

Sisu Inject
https://www.eclipse.org/sisu
Eclipse Public License 2.0
17 stars 15 forks source link

Add a method to allow LifecycleManager to free keys #75

Closed laeubi closed 1 month ago

laeubi commented 1 year ago

Currently there is no way to ever remove a key from the map, this can lead to accumulation of memory as it is strongly referencing the class.

This adds a new method so keys can be removed from the map

Fixes #74

@cstamas @gnodet can you take a look?

cstamas commented 1 year ago

FYI, this is Java 7 project

laeubi commented 1 year ago

FYI, this is Java 7 project

FYI even Java 8 is EOL for a long time, so maybe time to upgrade :-)

But I'll adjust the code then... at least try to do so.

laeubi commented 1 year ago

@cstamas rebased and changed to java 7 style

laeubi commented 1 year ago

I have no idea why the ECA check fials, the ECA tool sais it is valid and I use it all the time for eclipse contributions...

mcculls commented 1 year ago

Hi @laeubi - thanks for the PR, just wondering if a simple flush(ClassLoader) would also work? ie. remove all entries for classes from the given class-loader. It's not a big deal if that removes more entries than strictly necessary, because any missing entry will get recreated if it's ever needed again in the future.

mcculls commented 1 year ago

( I also re-ran the ECA check and it passed, so seems to have been a temporary glitch )

laeubi commented 1 year ago

I just thought it might be more flexible to check for a class, but a classloader would work for sure as well.

laeubi commented 7 months ago

@mcculls do you maybe want to take over the PR and just change it so it best fit the needs of sisu.inject project? I think the idea is quite clear on what to archive here?

cstamas commented 1 month ago

Retargeted PR against new default branch main, no other change done.

laeubi commented 1 month ago

@cstamas please apply / use this as you find appropriate...

cstamas commented 1 month ago

Superseded by https://github.com/eclipse-sisu/sisu-project/pull/138