Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Issue when serialize and deserialize object list #77

Open
MarcoGuzzetti opened this issue Jun 16, 2017 · 6 comments
Open

Issue when serialize and deserialize object list #77

MarcoGuzzetti opened this issue Jun 16, 2017 · 6 comments

Comments

@MarcoGuzzetti
Copy link

Hi,
I'm using successfully the formatter in my project, but I have an issue: if i serialize an object like this:

public class Ob
{
public List List {get;set;}
}

all seems fine.
When I deserialize the object, I can see in the debugger window that the List type isn't CustomObject but instead a ZeroFormatter object (seems fine).

I can add and remove elements from list, but when I add only one element and then I try to serialize the object again, I can see the size of the serialized object was increased considerably (twice compared to first object).

Why? How can I resolve this?

Thank you

@cluedtke
Copy link

Seeing similar behavior. We ZeroFormatterSerializer.Serialize() objects into redis. Deserializing those bytes easily doubles the size of the object. Still trying to determine why. This is catastrophic when updating the same entity multiple times, and each update increases the serialization.

@robertvo
Copy link

robertvo commented Jan 2, 2018

me too. any solution?

@cluedtke
Copy link

cluedtke commented Jan 2, 2018

@robertvo, what I did was deep clone object before re-serializing. It's more of a hack, but it definitely keeps object size down.

@robertvo
Copy link

robertvo commented Jan 2, 2018

Yeah, thank you, but that's not going to work, I have like 1mil of objects :(

@lucjanl
Copy link

lucjanl commented Mar 16, 2018

I experience the same problem. This makes ZeroFormatter useless. Is there any plan to fix this?

@Skizomeuh
Copy link

Skizomeuh commented Apr 13, 2018

Hi,
I experience the same with a Dictionary<string, MyClass> in an Unity project. Can someone give me hints about deep cloning this kind of collection?
Dictionary<string, MyClass> copy = new Dictionary<string, MyClass>(original);
Doesn't seem to work.

[edit] Nevermind, I think I found how to: by simply recreating a fresh new dic by adding fresh new string key and fresh new Myclass value from each entry in the deserialized dic. this alternative to the bug will do the job for me as a "read from disk>deserialize>update dic>reserialize>write on disk" takes a mere 5s for approx. 100k entries dic.

So annoying little thing, this serializer is a pure gem otherwise...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants