Skip to content

Serializer.Unpack Continuosly Stream of Data => High Memory Usage #356

@rootfixxxer

Description

@rootfixxxer

I'm making some tests with this package and if I have a connection/stream that it's always sending data, the memory continues to raise until the system crashes.

Investigating the issue with a memory profiler I can see that it's always allocating this objects (there are others), and never disposing them:

  • MsgPack.MessagePackString
  • System.Byte[]
  • MsgPack.MessagePackObject[]
  • System.Collections.Generic.List<MsgPack.MessagePackObject>
  • System.String
  • MsgPack.MessagePackObjectDictionary

There's something that I can do be able to use this library in the cases?
Workaround?

Current usage:

var serializer = MessagePackSerializer.Get<MyType>();
while (!cancellationToken.IsCancellationRequested)
{
   var result = serializer.Unpack(myOpenStream);
   //Do nothing with the results, and the memory increases anyway
   result = null; //JIC makes no difference
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions