Skip to content

Commit

Permalink
Skip cleanup entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
vvuk committed Apr 2, 2024
1 parent cba67e4 commit 3657586
Showing 1 changed file with 5 additions and 27 deletions.
32 changes: 5 additions & 27 deletions src/coreclr/pal/src/misc/perfjitdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,34 +308,12 @@ struct PerfJitDumpState

int Finish()
{
int result = 0;

if (enabled)
{
enabled = false;

if (mmapAddr != NULL)
{
result = munmap(mmapAddr, sizeof(FileHeader));

if (result == -1)
return FatalError();
}

mmapAddr = MAP_FAILED;

result = fsync(fd);

if (result == -1)
return FatalError();

result = close(fd);
// There's no way to cleanly shut down (munmap and close the fd) without
// adding locks, which would slow down a hot operation. We deliberately
// skip cleanup here and let the OS take care of releasing resources on
// process exit.

if (result == -1)
return FatalError();

fd = -1;
}
enabled = false;

return 0;
}
Expand Down

0 comments on commit 3657586

Please sign in to comment.