Added coreclr_unity profiler api for getting AssemblyLoadContext information #278
+52
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To detect AssemblyLoadContext leaks which are coming from static fields we need to be able to:
Unfortunately there is no link in managed for both cases (AssemblyLoadContext and LoaderAllocator can't know about each other to be able to actually unload ALC). However in native there is an AssemblyBinder class which knows about both objects through a native handle, and can directly point to the ALC for a given class.
The PR introduces:
coreclr_unity_profiler_assembly_load_context_get_loader_allocator_handle
- api to retrieve LoaderAllocator handle for an AssemblyLoadContext instance.coreclr_unity_profiler_class_get_assembly_load_context_handle
- api to return AssemblyLoadContext handle for a class instance.It may be possible to suggest a public API to upstream in the future to support this information