6.01 Weird container / canvas memory leak
Posted: Fri Mar 17, 2023 10:22 pm
If you run this code, grab a window corner and start resizing the window constantly the ram usage of the program keeps increasing until you stop resizing the window. W10 X64
Code: Select all
EnableExplicit
Procedure on_size()
ResizeGadget(1, 0, 0, WindowWidth(0) / 2, WindowHeight(0) / 2)
ResizeGadget(2, WindowWidth(0) / 2, 0, WindowWidth(0) / 2, WindowHeight(0) / 2)
ResizeGadget(3, 0, WindowHeight(0) / 2, WindowWidth(0) / 2, WindowHeight(0) / 2)
ResizeGadget(4, WindowWidth(0) / 2, WindowHeight(0) / 2, WindowWidth(0) / 2, WindowHeight(0) / 2)
; ResizeGadget(5, 0, 0, WindowWidth(0), WindowHeight(0))
EndProcedure
OpenWindow(0, 10, 10, 600, 400, "Test", #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget | #PB_Window_SystemMenu)
BindEvent(#PB_Event_SizeWindow, @on_size())
ContainerGadget(1, 0, 0, 0, 0)
CloseGadgetList()
ContainerGadget(2, 0, 0, 0, 0)
CloseGadgetList()
ContainerGadget(3, 0, 0, 0, 0)
CloseGadgetList()
ContainerGadget(4, 0, 0, 0, 0)
CloseGadgetList()
SetGadgetColor(1, #PB_Gadget_BackColor, RGB(255, 0, 0))
SetGadgetColor(2, #PB_Gadget_BackColor, RGB(0, 255, 0))
SetGadgetColor(3, #PB_Gadget_BackColor, RGB(0, 0, 255))
SetGadgetColor(4, #PB_Gadget_BackColor, RGB(255, 0, 255))
; ButtonGadget(5, 0, 0, 0, 0, "Test")
on_size()
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
