Open richdog opened 9 months ago
I found it. Firstly we set capacity in JaggedArray constructor. Then we EnsureCapacity and check newCapacity < Capacity (They are same by constructor) so it increases capacity again.. I think fix should be simple @genaray @richdog
Upd. I tried to remove world.EnsureCapacity(versions.Capacity); in serializer. It helped a bit, but still leaking.
Thanks! What do you think is the second leak problem?
Every time I save the same world after loading, the world grows. This happens even if I save an empty world. This also happens with both Binary and JSON serialization.
I've attached two copies of the world JSON, once from the first save, and again after loading and saving again. note that it keeps growing every time I save and load, not just the first time.
world-empty-1.json world-empty-2.json
I tracked it to this point:
I dug a bit deeper after this and it seems to do with the way the capacity is calculated, and serialized. I attempted serializing/deserializing the capacity of just a single bucket instead of the total capacity, which seemed to partially fix the issue, but it would still grow in some cases so I moved on to other things.