Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix gc hole in Frozen.cs #76868

Merged
merged 3 commits into from
Oct 11, 2022
Merged

Fix gc hole in Frozen.cs #76868

merged 3 commits into from
Oct 11, 2022

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Oct 11, 2022

Fixes #76856

Confirmed that the test stopped crashing after this change.

@ghost
Copy link

ghost commented Oct 11, 2022

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

Issue Details

Closes #76856

Author: EgorBo
Assignees: -
Labels:

area-GC-coreclr

Milestone: -

Copy link
Member Author

@EgorBo EgorBo left a comment

Choose a reason for hiding this comment

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

@EgorBo EgorBo force-pushed the fix-gc-hole-frozen branch from 6cf8a07 to d6f1257 Compare October 11, 2022 11:32
ref Unsafe.As<RawData>(obj).Data;

internal static unsafe IntPtr GetMethodTablePointer(object obj) =>
(IntPtr)Unsafe.Add(ref Unsafe.As<byte, IntPtr>(ref obj.GetRawData()), -1);
Copy link
Member

Choose a reason for hiding this comment

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

This assumes that offset 0 is a valid byref. It happens to be true in CoreCLR today, but it is not a safe assumption to make.

EgorBo and others added 2 commits October 11, 2022 17:51
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Copy link
Member

@cshung cshung left a comment

Choose a reason for hiding this comment

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

Thanks for the fix

@EgorBo EgorBo merged commit af63f60 into dotnet:main Oct 11, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Nov 11, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test failure: GC\\API\\Frozen\\Frozen\\Frozen.cmd
3 participants