Forum Xamarin.Android

String object's memory does not clear after a GC and occupies a lot of memory.

I created a simple android app where I create a string using a StringBuilder which is very long and store it into a string variable. Then if I navigate away from that layout or force a GC call that memory for that string is not released completely.


  • EspectrosEspectros Member ✭✭

    in the OnDestroy Method call GC.Collect();
    I ran into this same problem, seems that GC never sees the objects to be removed from memory.
    I can think is a workaround

  • SushilTripathi.9693SushilTripathi.9693 USMember ✭✭

    I did call the GC.Collect() and also marked the strings and StringBuilder as null before calling it, but then too it does not release the memory.

Sign In or Register to comment.