-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Added a max memory usage monitor #410
base: main
Are you sure you want to change the base?
Conversation
I really like this idea but this thing is super slow. If I add this one line to MyBot:
The call to ObjectSizeHelper.GetSize(..) takes more than 20 secs on my machine. This is bad enough in itself but this call counts as time spend by the bot so it quickly times out... |
@DrBrask I have a workaround for the tuples, also the timer should not include the calculation time anymore. |
- stop the clock when calculating the memory usage
a7c68ff
to
d632013
Compare
That's much better! ObjectSizeHelper.GetSize(..) never got above 4ms in 20 games or so. For development I think this is useful. For competition however I think a better setup, is to compile each MyBot class as separate UCI compliant program and run the two bot players as separate processes, measuring their memory usage, subtracting the baseline memory usage of the simplest possible bot. |
Hey, very cool what you did there! Is this for version 1.18? Alright is just downloaded is and it looks like it is, thanks! |
I would assume the memory limit is for the process, not for the bot-specific code, I recommend just using Process.PrivateMemorySize64. |
Not necessarily, unless we could run the different bots in their own process space, Another thing I've noticed is that memory usage can vary from game to game, so I keep track of the maximum memory size used. |
Added support to monitor the bot's memory usage. Trying to solve #396
Since the framework does not natively support calculation of memory usage of a single object,
I used reflection to calculate the size of each reachable object through MyBot.
Depending on the memory structures used, it can be quite slow (reflection).
The remaining time is not affected for the other bot (EvilBot).
Also, "cheaters" can still access static objects that are not contained within MyBot. Those won't be factored into the memory usage.
Initially I wanted to have two stacked bars, but the height of the board has too many hard code values here and there.
So I split the bar in two :)