Good morning everyone! This is the problem I have ...
# kvision
a
Good morning everyone! This is the problem I have right now; I have a SimplePanel with a Tabulator inside and collections that I use to display data and set up/configure the table. The problem comes when I want to delete it. It seems that not only does it get deleted when I call dispose(), but if I don't delete the collections manually, they end up piling up in the memory heap, and as you navigate through the app, they just stack up without being cleaned up by the garbage collector. Is there any reason for that to happen?
r
Hello, Can you show some more code details of how is your tabulator component configured?
a
Copy code
tabulator = Tabulator(vehicles,
                      kClass = VehiclesSectionVehicle::class,
                      options = TabulatorOptions(
                          placeholder = "No data available",
                          layout = Layout.FITDATAFILL,
                          footerElement = "<div id=\"tabulator-footer\"><div>",
                          renderVertical = RenderType.VIRTUAL,
                          height = "100%",
                          maxHeight = "100%",
                          dataTree = true,
                          autoColumns = false,
                          columns = mutableListOf(
                              checkboxColumnDefinition(),
                              onlineColumnDefinition(),
                              imeiColumnDefinition(),
                              tagsColumnDefinition(),
                              augColumnDefinition(),
                              lastSeenOnlineColumnDefinition(),
                              deviceModelColumnDefinition(),
                              deviceFirmwareVersionColumnDefinition(),
                              iccidColumnDefinition(),
                              vehicleTypeColumnDefinition(),
                          ).also {
                              it.addAll(extraColumns(vehicles))
                              it.addAll(lastReportColumnDefinitions(lastReportColumns))
                          }
                      ),
                      types = setOf(BORDERLESS, HOVER))
With
vehicles
being an ObservableList<>
r
and what do you do to remove the component?
Tabulator components keeps the reference to your list. But I don't see any reason why it shouldn't be garbage collected when the component itself is no longer referenced and collectable.
I must go now - I'll be back in an hour and make some more tests.
a
I have some sort of presenter to switch from SimplePanel to SimplePanel, and when I switch to another, I call dispose, and it's overridden.
if it helps, the table is humongous, with 20 columns and almost 5000 rows
r
the tabulator component is recreated when you switch back?
a
of course
r
so generally you are disposing and recreating component with the same data list? and ram usage is growing?
a
the data list might change, but basically yes
just going back and forth between pages do the thing
Are you able to replicate it or you need more info?
r
still working on this
yep, I've reproduced the problem - it seems to be specific to the
ObservableList
stadard MutableList seems to be perfectly garbage collected
now it seems obvious - tabulator component subscribes to the observable list but never unsubscribes
a
Great! I'm going to test it right away
r
I've published 6.0.3 to maven central a minute before your message 😉
Now I have to rebuild and publish 6.0.4 😉
@adonis 6.0.4 is published. Please upgrade and check your application.
a
thanks a lot!