Skip to content
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

[release/8.0-staging] Clean up the thread local memory regardless of managed thread's presence #95722

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions src/coreclr/vm/ceemain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1752,9 +1752,9 @@ struct TlsDestructionMonitor
GCX_COOP_NO_DTOR_END();
}
thread->DetachThread(TRUE);
DeleteThreadLocalMemory();
}

DeleteThreadLocalMemory();
ThreadDetaching();
}
}
Expand Down Expand Up @@ -1786,16 +1786,11 @@ void DeleteThreadLocalMemory()
t_ThreadStatics.NonGCMaxThreadStaticBlocks = 0;
t_ThreadStatics.GCMaxThreadStaticBlocks = 0;

if (t_ThreadStatics.NonGCThreadStaticBlocks != nullptr)
{
delete[] t_ThreadStatics.NonGCThreadStaticBlocks;
t_ThreadStatics.NonGCThreadStaticBlocks = nullptr;
}
if (t_ThreadStatics.GCThreadStaticBlocks != nullptr)
{
delete[] t_ThreadStatics.GCThreadStaticBlocks;
t_ThreadStatics.GCThreadStaticBlocks = nullptr;
}
delete[] t_ThreadStatics.NonGCThreadStaticBlocks;
t_ThreadStatics.NonGCThreadStaticBlocks = nullptr;

delete[] t_ThreadStatics.GCThreadStaticBlocks;
t_ThreadStatics.GCThreadStaticBlocks = nullptr;
Copy link
Member

Choose a reason for hiding this comment

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

believe this is just cleanup based on last PR, and doesn't affect the fix?

Copy link
Member

Choose a reason for hiding this comment

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

Correct - this addressed @AaronRobinsonMSFT's comment in #95362 (comment)

}

#ifdef DEBUGGING_SUPPORTED
Expand Down
Loading