Skip to content
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

World grows after deserialization #60

Open
richdog opened this issue Dec 18, 2023 · 2 comments
Open

World grows after deserialization #60

richdog opened this issue Dec 18, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@richdog
Copy link
Contributor

richdog commented Dec 18, 2023

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:
image
image

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.

@genaray genaray added the bug Something isn't working label Jan 29, 2024
@genaray genaray moved this to Todo in Arch Roadmap Jan 29, 2024
@ArhinZi
Copy link

ArhinZi commented Mar 31, 2024

image

image

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.

@genaray
Copy link
Owner

genaray commented Apr 8, 2024

Thanks! What do you think is the second leak problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

3 participants