Skip to content

Commit

Permalink
- log exceptions when memory usage cannot be determined
Browse files Browse the repository at this point in the history
- stop the clock when calculating the memory usage
  • Loading branch information
ryanheath committed Jul 31, 2023
1 parent 9bd8517 commit d632013
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,22 @@ void OnMoveChosen(Move chosenMove)
playMoveTime = lastMoveMadeTime + MinMoveDelay;
if (PlayerToMove.Bot is MyBot)
{
maxMemoryUsed = Math.Max(ObjectSizeHelper.GetSize(PlayerToMove.Bot), maxMemoryUsed);
isPlaying = false;
try
{
maxMemoryUsed = Math.Max(ObjectSizeHelper.GetSize(PlayerToMove.Bot), maxMemoryUsed);
}
catch (Exception e)
{
Log("An error occurred while determining used memory size.\n" + e.ToString(), true,
ConsoleColor.Red);
hasBotTaskException = true;
botExInfo = ExceptionDispatchInfo.Capture(e);
}
finally
{
isPlaying = true;
}
}
}
else
Expand Down

0 comments on commit d632013

Please sign in to comment.