Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize CDI observers properly #489

Merged
merged 2 commits into from
Jan 14, 2019

Conversation

mkouba
Copy link
Contributor

@mkouba mkouba commented Jan 13, 2019

for (InterceptorInfo interceptor : interceptors) {
interceptor.init();
}
beans.forEach(BeanInfo::init);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we want to be encouraging the use of lambda's like this. At the moment AFAIK they use about 4k of memory in metaspace, so this code will now use 12k of metaspace instead of basically being free. In this case it is in the processor so I don't know how much it matters as it is not runtime.

@n1hility @dmlloyd do you think we should ban the use of lambas in the code base? Even though they make some code a bit cleaner I don't think it is worth the memory overhead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we already use a lot of lambdas in processors and I think that it's probably worth the memory overhead. Also we should have some exact numbers - is it really 4K for a method reference? I tried to find some relevant info but I did not find anything.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This info may be old, at one point the JDK was basically creating a new class loader per lambda, and that class loader allocates 4kb of space by default. It sounds like this was something that could be fixed, however I am not sure if it has been.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I've been using lambdas with a fairly clear conscience in code that is run at augment time only, or code that will only ever be used in substrate mode. I've only been avoiding them for runtime code that can be run in JVM mode.

@stuartwdouglas
Copy link
Member

Other than the lambda issue I think this looks good to me.

@stuartwdouglas
Copy link
Member

I am just going to merge this for now, if we decide to do something about reducing lambdas in the code base it will need to be addressed on a project level.

@stuartwdouglas stuartwdouglas merged commit 8209cdb into quarkusio:master Jan 14, 2019
@stuartwdouglas stuartwdouglas added this to the 0.6.0 milestone Jan 14, 2019
maxandersen pushed a commit to maxandersen/quarkus that referenced this pull request Nov 5, 2022
today it only check the //SOURCE, but it must also
consider the origin.
[patch]
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.

NullPointerException when resolving a CDI injection
3 participants