the code is more than 6000 rows. I'm pretty sure that the problem is the Tableview.
For Each FileNameToParse As String In File.ListFiles(FolderRoot & "/" & FolderWork)
If FileNameToParse.ToUpperCase.EndsWith(ElaboraSoloEstensione.ToUpperCase) Then
Sub AddRowTableViewKdm(TempFileName As String)
Dim lblRow As Label
Dim chkRow As CheckBox
lblRow.Text = TempFileName
If ParseNomeFileKdm(TempFileName.ToUpperCase, False) Then
chkRow.Checked = True
chkRow.Enabled = True
lblRow.Style = "-fx-text-fill: coral;"
chkRow.Checked = False
chkRow.Enabled = False
If tvKdm.GetColumnWidth(COL_FILE) > 10 Then
lblRow.PrefWidth = tvKdm.GetColumnWidth(COL_FILE)
lblRow.PrefWidth = 1500
tvKdm.Items.Add(Array As Object(lblRow, chkRow))
lblFileSelezionati.Text = "File selezionati " & FileSelezionati & "/" & tvKdm.Items.Size
MsgBox.DialogType = "error"
MsgBox.Show2("ERRORE DURANTE L'AGGIUNTA DELLA RIGA <" & TempFileName & ">" & CRLF & LastException.Message, AppTitle, BtnOk, "", "")
maybe you created an infinite loop or something like that. I got a memory leak in one of my apps when I was creating and deleting large amounts of items, several times per second.
I'll just throw some things that could be the cause:
- Images that are too big
- Too many nodes created
- Too big structures, like types, arrays and maps
- too big SQL queries
- unclosed SQL pools
As you see It's quite difficult to imagine what is causing your problem without seeing more. The code you posted doesn't seem like the cause. It could be that the loop that calls "AddRowTableViewKdm" is the problem. How many items are there in your tableview?
that's the kind of info you should have provided since the beginning!
It could be the issue. You have 10k checkboxes and labels. Have you tried to split in pages ? Maybe you could do pages of 100 items, or implement filters?
Edit: you could try to limit the number of items, and see if you still get the memory leak.
I have done many tests with only 50 records and the situation does not change. you delay the time of the crash but at the end happens. I continue to believe that the problem is in the improper management of the memory of Tableview. in programs where no Tableview control there are never problems of this type.
renew the call for help to convert the instructions below to affix b4j.
In my program I added tv.SetColumns (Array ("Column 1", "Column 2")) after tv.Items.Clear and this causes the memory leak.
If you want you can also try it in your code.
Why is it so important to NOT enter SetColumn after the Clear?
Thanks not much but million for guiding me in the right direction towards solving this huge problem that I had.