jamesmontemagno / monkey-cache

Easily cache any data structure for a specific amount of time in any .NET application.
MIT License
663 stars 105 forks source link

Out of memory exception #92

Open dalton5 opened 3 years ago

dalton5 commented 3 years ago

Hi,

I have this exception:

image

Do you know what can be the cause?

In my json deserialization I have this:

.AddJsonOptions(options => { options.SerializerSettings.PreserveReferencesHandling = PreserveReferencesHandling.Objects; });

May you add this option?

The stacktrace:

at (wrapper alloc) System.Object.AllocVector(intptr,intptr) at System.Text.StringBuilder.ExpandByABlock (System.Int32 minBlockCharCount) [0x00080] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Text/StringBuilder.cs:2231 at System.Text.StringBuilder.Append (System.Char* value, System.Int32 valueCount) [0x000a3] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Text/StringBuilder.cs:1914 at System.Text.StringBuilder.Append (System.Char[] value, System.Int32 startIndex, System.Int32 charCount) [0x00066] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Text/StringBuilder.cs:651 at System.IO.StringWriter.Write (System.Char[] buffer, System.Int32 index, System.Int32 count) [0x0006f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/io/stringwriter.cs:123 at Newtonsoft.Json.JsonTextWriter.WriteValue (System.DateTime value) [0x0002b] in <2073514815234917a5e8f91b0b239405>:0 at Newtonsoft.Json.JsonWriter.WriteValue (Newtonsoft.Json.JsonWriter writer, Newtonsoft.Json.Utilities.PrimitiveTypeCode typeCode, System.Object value) [0x002d2] in <2073514815234917a5e8f91b0b239405>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializePrimitive (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonPrimitiveContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x00054] in <2073514815234917a5e8f91b0b239405>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x00100] in <2073514815234917a5e8f91b0b239405>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x00057] in <2073514815234917a5e8f91b0b239405>:0

jamesmontemagno commented 3 years ago

How big is the file you are writing?

dalton5 commented 3 years ago

Hi,

How can I know the size p;lease?

Thanks,

jamesmontemagno commented 3 years ago

Just curious like what you are saving, what operating system, what version of monkey cache are you using?

A repro would be good.