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

Serialization when saving a large tree. Workaround is to use FsPickler #22

Open
fwaris opened this issue Apr 1, 2021 · 0 comments
Open

Comments

@fwaris
Copy link

fwaris commented Apr 1, 2021

Saving a

    let t1 =  new KdTree<float, Alrm>(1, new DoubleMath());
    t1.SaveToFile(@"D:\alarms\alarmIndex.bin")

Gives the following error with about 7M entries:
System.Runtime.Serialization.SerializationException: The internal array cannot expand to greater than Int32.MaxValue elements.
at System.Runtime.Serialization.ObjectIDGenerator.Rehash()
at System.Runtime.Serialization.ObjectIDGenerator.GetId(Object obj, Boolean& firstTime)

However this worked for both saving and loading:

    let ser = MBrace.FsPickler.BinarySerializer()
    ser.Serialize(IO.File.Create @"D:\alarms\alarmIndex.bin", t1)
    let t2:KdTree<float, Alrm> = ser.Deserialize(IO.File.OpenRead @"D:\alarms\alarmIndex.bin")

Maybe you can switch to FsPickler internally for serialization

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