I solved my previous problem but now I have a subquestion. How can I identify what's using my memory so I can clean it.
For example these two methods:
Public List As New List(Of String)
Private Sub ReadList()
Dim ListJSON As JArray = JArray.Parse(My.Resources.list) 'List in json format
For Each item As JObject In ListJSON
List.Add(item("name").ToString)
Next
ListJSON.RemoveAll()
GC.Collect()
GC.WaitForPendingFinalizers()
End Sub
Takes up 1GB before cleaning, takes 5s to complete. App is about 160MB in total after cleaning.
Public List As New List(Of String)
Private Sub ReadList()
Dim TempStringHold As String() = My.Resources.list.Split({"""name"":"""}, StringSplitOptions.None)
For Each StringSection In TempStringHold
List.Add(StringSection.Substring(0, StringSection.IndexOf("""")))
Next
List.RemoveAt(0)
Erase TempStringHold
GC.Collect()
GC.WaitForPendingFinalizers()
End Sub
Takes up 0.5GB before cleaning, takes 1s to complete. App is about 210MB in total after cleaning.
I would like to get those 50MB back somehow in the faster version.
Comments
Post a Comment