-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Reuse strings for memory usage #14289
Comments
Okay, I will do a PR. Would these strings still allocated if we just remove the |
We can use this one
|
It's not the @. It's that this string is injected in all generated views, so instead we need to inject a reference to a static string. Assuming this still works. Good to use an existing one if the compiled view has access to this property. |
Okay, this is what I did and that works, see #14290 Hmm, I thought that when we use an hard coded |
@jtkech That is my understanding of how interning works which seems confirmed with a bit of Googling. The @ might be causing issues as we see a TON of memory usage from the string "mvc.1.0.view" but @rjpowers10 didn't see many instances. |
Are you sure they are different instances, maybe the inclusive memory is not that high. In #14290 we no longer use Unless you are using razor runtime compilation.
But in
|
Yup.. I've verified the strings by extracting the values from a memory dump. I'm not convinced they are actually caused by OC at this point but I can't confirm since they don't have a gcroot. They're all just sitting around in gen2 for some reason not being collected. |
Okay, at least we no longer use I assume you are not using razor runtime compilation. Are you using a lot of Liquid files? |
@jtkech That's where things get REALLY weird.. afaik we don't use MVC at all. We have a completely separate/custom React UI that calls OC via API calls. I am going to pull in your change and run a perf test to see if it has any effect. |
Okay, let me know |
In razor code compilation we pass string like this: https://github.com/OrchardCMS/OrchardCore/blob/main/src/OrchardCore/OrchardCore.DisplayManagement/Theming/ThemingViewsFeatureProvider.cs#L28
The generated code for each view will then have these local strings. Could we pass a string that points to a static reference, like
"OrchardCore.DisplayManagement.Theming.ThemingViewsFeatureProvider.MvcVersion"
instead of@"mvc.1.0.view"
c.f. #14117 (comment)
The text was updated successfully, but these errors were encountered: