Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

sywhang
Copy link

@sywhang sywhang commented Apr 19, 2018

This same fix has been made in #17656 and #17594. I went through all the GC tests and fixed places where we observe a similar issue. Note that most of these tests don't necessarily depend on this fix, since the JIT won't inline methods / extend lifetime of temps for most of these tests, but wanted to fix these before we see more test failures coming from the various scenarios these tests will be running against.

@sywhang sywhang requested review from Maoni0 and davmason April 19, 2018 21:07
@sywhang sywhang self-assigned this Apr 19, 2018
temp.RunTest();

GC.Collect();
GC.WaitForPendingFinalizers(); // makes sure Finalize() is called.
Copy link
Member

Choose a reason for hiding this comment

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

WaitForPendingFinalizers [](start = 11, length = 24)

might as well add GC.Collect() here to be consistent

{
Console.WriteLine("In Finalize of B");
}
Console.WriteLine("In Finalize of B"); }
Copy link
Member

Choose a reason for hiding this comment

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

} [](start = 50, length = 2)

not sure why this } is moved... accident?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah.. Thanks for catching this.

@Maoni0
Copy link
Member

Maoni0 commented Apr 19, 2018

so I haven't done an exhaustive look...but based on what I've looked so far it makes more sense to just make this sequence into a little utility function that you call in situations like this:

GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();

so you don't have to worry about adding this to every test that needs it.

@sywhang
Copy link
Author

sywhang commented Apr 19, 2018

By utility function, I assume you mean just for all the GC tests and not like adding a managed API right?

@Maoni0
Copy link
Member

Maoni0 commented Apr 19, 2018

that's correct. it's a test utility function.

@sywhang
Copy link
Author

sywhang commented Apr 19, 2018

Ok, I'll throw that in and change the tests accordingly.

@sywhang sywhang merged commit 8d30abb into dotnet:master Apr 20, 2018
@sywhang sywhang mentioned this pull request Apr 24, 2018
@sywhang sywhang deleted the fix-gc-tests branch March 8, 2019 02:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants