3
My application is accumulating memory, only thing it does, that’s the bottom.
After 10-15 minutes, it comes to consume more than 1.5GB of memory, and continues consumption non-stop.
Run a Timer
every two minutes its function is:
Private Sub postGrupo_Tick(sender As Object, e As EventArgs) Handles postGrupo.Tick
ProgressBarStatus.Value = ProgressBarStatus.Value + 1
Try
StartPostGrupos()
Catch ex As Exception
End Try
End Sub
Sub StartPostGrupos()
Dim value As Integer = ProgressBarStatus.Value
Select Case value
Case 10
If WebBrowser1.DocumentText.Contains("Iniciar discussão") = True Then
For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("a")
If element.GetAttribute("data-endpoint") = "/ajax/composerx/attachment/group/post/" Then
element.InvokeMember("click")
End If
Next
End If
Case 20
If postImgGo = 1 Then
If File.Exists(imgGroupsDir & imgGroupsName) Then
For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("a")
If element.GetAttribute("data-endpoint") = "/ajax/composerx/attachment/media/chooser/" Then
element.InvokeMember("click")
End If
Next
selecionarIMG.Start()
End If
End If
Case 50
Dim FILE_NAME As String = "config/msgGroups.txt"
If System.IO.File.Exists(FILE_NAME) = True Then
Dim texto As New StreamReader(FILE_NAME)
Dim Elems As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("textarea")
For Each Elem As HtmlElement In Elems
If Elem.Name = "xhpc_message_text" Or Elem.Name = "xhpc_message" Then
Dim value2 As String = texto.ReadToEnd.Replace("[tituloGrupo]", WebBrowser1.DocumentTitle)
Dim value3 As String = value2.Replace("[codigoRandom]", CInt(Int((999999999 * Rnd()) + 1)))
Dim value4 As String = value3.Replace("[urlGrupo]", WebBrowser1.Url.ToString)
Dim value5 As String = value4.Replace("[dataAtual]", DateTime.Now.ToString("dd/MM/yyyy"))
Dim value6 As String = value5.Replace("[horaAtual]", DateTime.Now.ToString("HH:mm"))
'Elem.InnerHtml = value6
Elem.SetAttribute("value", value6)
Exit For
End If
Next Elem
End If
Case 80
For Each elem As HtmlElement In WebBrowser1.Document.GetElementsByTagName("button")
If elem.GetAttribute("type") = "submit" Then
If elem.InnerText = "Publicar" Then
elem.InvokeMember("click")
End If
End If
Next
Case 85
For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("button")
If element.GetAttribute("className") = "_42ft _4jy0 _11b _4jy3 _4jy1 selected _51sy" Then
element.InvokeMember("click")
End If
Next
Case 99
If WebBrowser1.DocumentText.Contains("Publicar") Then
If Label22.Text = "-------------" Then
Label22.Text = 1
Else
Label22.Text = Label22.Text + 1
End If
End If
FlushMemory()
ProgressBarStatus.Value = 0
postGrupo.Stop()
End Select
End Sub
It’s really what you wrote is a great comment, and little opportunity to read something like that... in relation to what you reported on Webbrowser, which is always running, after using a command, go into pages, check pages and etc, how would you maybe clear his cache, or there’s nothing to it? thank you!!!
– Leonardo Joksan