While trying Xojo Web I’ve stumbled upon various WebControls that remain in Memory forever (Memory Leaks…?).
Likely related to the fact that I’m using WebContainer
’s, or that those never-released Controls are within WebContainers
.
I’ve tried to make sure that all AddHandler
have a RemoveHandler
.
And when in one example container I’ve been using a WebDataSource
which is within the Parent of the ListBox that gets the WebDataSource, it gets nil
-ed out when being closed (not to get a circular reference).
While having placed Issue 76039 I’m still curious…
- is this my mistake? What have I done wrong so that those Containers/Controls/Dialogs don’t get released?
- is this really yet another Memory/Framework Issue in the Xojo Web Framework?
- but most importantly… who finds a workaround to get these Controls released?
I’ve tried various things in.Close
andDestructor
’s in this example - without success Image may be NSFW.
Clik here to view.
If you’d like to try, then get the example project from the linked Issue 76039.
While the Login Page is showing, the expected output of Objects in the Xojo Runtime are:
- LoginPage: 1
- WebButton: 1
- WebLabel: 1
You then can “Login”, and use the ToolBar to show some content.
- Container Main is shown by default (empty Listbox)
- Container One: you can add/delete items shown in the Listbox
- Container Two: uses a WebDataSource (which is the container itself) and you can add/delete items shown in the Listbox
Once you logout, all Containers should have been closed and no longer be in memory.
So after clicking “Logout”, the expected Runtime Objects shown are again:
- LoginPage: 1
- WebButton: 1
- WebLabel: 1
With just “Login” (showing “Container Main”) and “Logout” → all great.
With “Login”, then “Container One”, then “Logout”:
- a Dialog placed in “Container One” doesn’t get released
- however, the shown “Container One” itself gets released
With “Login”, then “Container Two”, then “Logout”:
- “Container Two” doesn’t get released
- also still in Memory forever: “DialogAdd”, a WebMessageDialog
- and WebControls such as Buttons, Labels (most likely those of the not released WebDialogs/WebContainers)
While Xojo can investigate the placed Issue… if someone would like to try this and find a way to get everything cleaned up upon “Logout” I’d appreciate that. I’d like to know if there’s some workaround to get that expected result (or point out where I’ve done something wrong in this silly, simple example while trying XojoWeb)…
…but meanwhile this most likely means for many Xojo Web Projects that it’s Memory is increasing steadily, requiring the WebApps to be restarted every now and then.
It would be interesting to know if others have placed WebDialogs
in WebContainers
, too - and if your get the same effect(s) in your real Xojo Web applications.
2 posts - 1 participant