B4J Question A question about RemoveAllNodes

Mashiane

Expert
Licensed User
Longtime User
Hi

RemoveAllNodes.png

Step 1,2,3

When my app starts, it loads a view called vMain which has a SplitPane called splitMain.
Inside that SplitPane, it loads another view called vProjectTree which has a treeview called treeProject and then another view called vParent which has a normal pane, this is called pnlParent.

This panel, pnlParent is where everything else goes as it can host any layout including my custom views.

Step 4
So normally, when a user interacts with treeProject e.g. selecting a node, stuff will load on the panel. This is achieved by calling

B4X:
pnlParent.RemoveAllNodes
pnlParent.LoadView("vPageMaster")

where vPageMaster is a TabPane that can host other controls.

My question is, when one executes .RemoveAllNodes in a panel, does it clear the memory and nullifies everything that was loaded inside it? If not, how do I ensure that everything inside it irrespective of type gets trashed?

Thanks.
 

Mashiane

Expert
Licensed User
Longtime User
I think I have an idea of what could be the cause.

My custom control creates controls during runtime whether these are checkboxes, textboxes and combo boxes. This happens everytime a treenode is selected and these could be housed in any three or four tabs (in tabpane) at a time. These sadly enough are not thrashed.

I experimented with selecting items in my treeview, there are about 160 nodes or so, the app ended up crashing. I also wrote something to see if there are any items inside a tableview that were left during the previous call, checking this after the RemoveAllNodes call, and it appears there are and I'm sure its the controls that were created during runtime. I will see if I can perhaps create views in the designer then instead of creating the controls, just load the view with the control and reference them.

CrashReport.png


MemoryUsage.png
 
Upvote 0
Top