I created a 64-bit Linux Standalone web app. I’m testing multiple user sessions and monitoring memory usage both within the Xojo debugger environment (using Activity Monitor on Mac) and when deployed on an Apache server. In general, with each new session I see the memory assigned to the process increase. When the session is closed, the memory is never released. After opening and closing several sessions, RAM usage exceeds several GBs and the process crashes.
I understand in can take a few minutes before memory is freed when a session ends. I can close down all browsers, wait for several hours and then check the RAM assigned to that process and still no memory has been freed.
The problem can be demonstrated with a single web page that contains a property something like this:
fData(1000,1000) as byte
I made a few tests.
You need to wait 2 minutes for a season to disappear and the webpage with array is freed for me.
Memory allocations are different. Once malloc added memory, it should reuse it for new arrays and doesn’t give it back to the OS right away.
If this hits you, maybe make a sample project, record a video of your tests and report via Feedback.
When I initially launch the standalone web app on a Linux server, the app requires 170MB. If I open one browser session to use the App, the process is now using 250 MB. The memory usage gradually increases to 400 MB with 6 concurrent sessions. If I close all sessions, wait 15 minutes and check memory usage it is now 385 MB so it did free 5 MB.
If I now open 6 browser sessions again, memory use is up to 400 MB again.
I can repeat this cycle over and over again. It looks like RAM usage grows to handle the max number of concurrent sessions. When those sessions close RAM is never fully released by the process, but can be reused later for other sessions.
Unfortunately, our real life application requires 200 MB per session so the RAM required by the app quickly grows to several GBs after a dozen concurrent sessions are opened and then is never fully freed for use by other processes.