Out of Memory
Hey guys, I'm currently writing my Chess Bot further on. Now I run into Browser Errors "out of memories" after about half the game. Any of u is familiar with this error / how can I errorhandle this
Hey guys, I'm currently writing my Chess Bot further on. Now I run into Browser Errors "out of memories" after about half the game. Any of u is familiar with this error / how can I errorhandle this
What browser are you testing the program in?
When I tested MicroStudio in terms of how much memory it could allocate
If the error disappears after changing the browser, it means that you have reached the allowed limit for Chrome.
Open the "Task Manager" built into your browser and check how much memory you are using.
Free up memory and there will be no problem.
There is even a game in the explore section that uses the crash mechanism
There is a second possible cause - you do too much recursion, and the reference stack overflows. Add a limiting condition.
Yeah, I tested it with dev tools. I think 1gb is the limit (I'm using chrome).
How to free up memory in Js?
Each element that has been allocated memory has a reference counter that is not available to the program - it is managed by the javyscript virtual machine.
obj = { x = 1, y = 2, z = 3 }
for javascript to remove the element from memory, the reference counter must drop to zero.
obj = null
The easiest way to remove elements is to set the fields that pointed to a given object and change the value of such a field to null.
Okay, thx. I'll make some tests
https://microstudio.io/KingLauri200/micro_chess/ this is my programm. You can check the memory allocation if u want. But man, the code is kind of messy