utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
576 stars 39 forks source link

Update benchmark and MemoryManager fixes #521

Closed CedNaru closed 10 months ago

CedNaru commented 10 months ago

Upgraded the benchmarks we left in the dust for way too long. I had the terrible idea of never running it after doing the memory rework for Godot 4. I discovered a few leaks with the stress tests so I fixed them. I had to add a lock again in the BindingManager, which I don't like. I also suspect that Refcounted can leak in certain cases as well but to be sure, we'll have to wait for multithreading to properly work so I can test it in the correct condition, but I'm not fixing it until I see it happening. The consequence will likely be to expand the use of the spinlock to the reference callback.

That solution right now is a "band aid", we are using a single spinlock for all binding operations, even when it's for 2 unrelated objects that won't interfere with each other.
I'll try a difference design once we switch to Godot 4.2, and I can start implementing #508. (Probably use some SafeFlag in the KotlinBinding instead).

I removed the C# files because we didn't even implement all the tests with them back in Godot 3 anyway. (Don't worry about the removed .gdj, they are obsolete files from a previous PR that never got deleted)

As a side effect, also implement #506