Skip to content

WELD-2834 Optimize in which cases Weld keeps reference to dependent instnace in CreationalContext#3314

Merged
manovotn merged 1 commit intoweld:masterfrom
manovotn:optimizeCreationalContextReferenceStoring
Mar 6, 2026
Merged

WELD-2834 Optimize in which cases Weld keeps reference to dependent instnace in CreationalContext#3314
manovotn merged 1 commit intoweld:masterfrom
manovotn:optimizeCreationalContextReferenceStoring

Conversation

@manovotn
Copy link
Member

@manovotn manovotn commented Mar 5, 2026

An attempt to bring Weld closer to what ArC does - avoid keeping dependent bean references in CreationalContext unless the bean has some form of pre-destroy callback.

Without this PR, Weld always puts bean's interceptor/decorator into the CC of that given bean.
This in turn means that the bean then always has dependents and cannot be further optimized.
In theory, it should be possible to circumvent this as we only really need the reference if there is some destroy logic that we'll need to execute.

@manovotn manovotn marked this pull request as ready for review March 5, 2026 14:24
@manovotn
Copy link
Member Author

manovotn commented Mar 5, 2026

FTR, I have also tested this with the reproducer from WELD-2834 and the memory leak no longer shows.
The application is still wrong in that it should handle bean destruction properly but at least we aren't leaking.

@manovotn manovotn merged commit 34f3e0c into weld:master Mar 6, 2026
16 checks passed
@manovotn manovotn deleted the optimizeCreationalContextReferenceStoring branch March 6, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant