Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

davidwrighton
Copy link
Member

While debugging performance issues with process startup from a customer, I noticed that we spent a measurable amount of time in the OS memory allocator allocating the memory for MethodData structures.

I found a couple of things

  • We were creating MethodDataObject structures that contained information about all methods (including non-virtuals) when most uses within the type loader were both non-cacheable creations, and ignored all non-virtual functions.
    • Add a concept of allocating and filling either a full MethodDataObject or one that only had virtuals in it.
  • When allocating the memory for MethodDataInterfaceImpl structures we were allocating it based on the number of methods on the type, but we were only utilizing the memory associated with the number of virtuals on the type. Change to allocate the correct size.
  • We had a case where we only needed to get the MethodData if it existed in the cache, and update the cached copy. Adjust the path so that it can avoid allocating the MethodData at all in that case.

- Compute exact amount of memory to allocate
- Only generate data for virtuals in most cases
@davidwrighton davidwrighton merged commit de04898 into dotnet:main Jan 25, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants