B4J Question Increase in ram usage in running application

serro efe

Member
Licensed User
Hi
In the project I wrote for testing, there are 2 "layouts" and 2 buttons and 2 textfields on them, they are never used. I run the compiled jar file on a mini pc with 1gb ram. There is a timer that can change "layouts" every 2 seconds without using them. Ram usage starts at 208mb and continues to increase continuously. After 20 minutes it became 316mb. There will be a problem in an application that will work continuously. How can I find the reason. How can I prevent it.

Test code:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
    #VirtualMachineArgs:  -Dcom.sun.javafx.isEmbedded=true -Dcom.sun.javafx.touch=True -Dcom.sun.javafx.virtualKeyboard=javafx
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Private Button1 As Button
    Private Button2 As Button
    Private Button3 As Button
    Private Button4 As Button
    Private TextField1 As TextField
    Private TextField2 As TextField
    Private TextField3 As TextField
    Private TextField4 As TextField
    Dim Timer1 As Timer
    Dim ffd As Byte 
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    ffd = 0
    MainForm = Form1
    MainForm.WindowWidth = fx.PrimaryScreen.MaxX - fx.PrimaryScreen.MinX
    MainForm.WindowLeft = fx.PrimaryScreen.MinX
    MainForm.WindowHeight = fx.PrimaryScreen.MaxY - fx.PrimaryScreen.MinY
    MainForm.WindowTop = fx.PrimaryScreen.MinY
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
    Timer1.Initialize("Timer1",2000)
    Timer1.Enabled = True
  
End Sub

Sub Timer1_Tick
    ffd = ffd +1
    If ffd = 1 Then
        MainForm.RootPane.RemoveAllNodes
        MainForm.RootPane.LoadLayout("Layout2")
    End If
  
    If ffd = 2 Then
        ffd = 0
        MainForm.RootPane.RemoveAllNodes
        MainForm.RootPane.LoadLayout("Layout1")
    End If
End Sub




ram1_Time_17_18.png
ram2_Time_17_40.png
 

serro efe

Member
Licensed User
I did not have the opportunity to test for a long time yesterday. Now I will make screen transitions for 0.5 seconds and do a long-term test.
I'll share the results when it's done
 
Upvote 0
Top