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

preserveObjectReferences causes serialization of large objects to hang #107

Open
shivanan opened this issue Dec 2, 2018 · 0 comments
Open

Comments

@shivanan
Copy link

shivanan commented Dec 2, 2018

When trying to serialize a large object, setting preserveObjectReferences to true causes the serialization to hang indefinitely.
I've only noticed this behavior with large objects.

I guess its perfectly fine to turn off that option, but thought I'd report it anyway as it seems strange.

Reproducible in both Wire and Hyperion and on .NET Core 2.1 and .NET Framework 4.6

static void Main(string[] args)
        {
            Hyperion.Serializer s = new Hyperion.Serializer(new Hyperion.SerializerOptions(preserveObjectReferences:true));
            var obj = new List<Dictionary<string, object>>();
            for (var i = 0; i < 1000000;i++)
            {
                var item = new Dictionary<string, object>();
                item["x"] = i;
                item["y"] = DateTime.Now;
                obj.Add(item);
            }
            var dict = new Dictionary<string, object>();
            dict["key"] = obj;

            using (var ms = new System.IO.MemoryStream())
            {
                s.Serialize(dict, ms);
                Console.WriteLine("Serialized Size: {0}", ms.Length);
            }


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

No branches or pull requests

1 participant