Advice/techniques on debugging web memory leak

I am a long time XOJO/Realbasic desktop developer who just started using the web target recently. A lot of things have gone exceedingly well, but my main application leaks memory to the point where it it either crashes or ought to be restarted every 3-4 days.

Is there a guide or SOP on techniques to help track these down? I develop on Windows but have to deploy on Alma Linux. I cannot really subject the Windows runtime to the same load/connections as exist in the real environment.

In short, I am polling a web api every few seconds, parsing the results and updating objects that are linked to a display dashboard. I really only have 3 clients connected at a time, and can see no correlation between number of clients and the memory growth.

I have added a display for Runtime.objectCount, RuntimeMemoryUsed and a table of object types and counts. The objectcount increases over time, as does the memory. The objects that seem to grow accordingly are Array, WeakRef, Delegate and _HTTPDelegateTimer.

Any advice would be appreciated. 2024 R1.1

Can you share the code that polls the web API?

Since November 2023, I have reported many memory leaks in the web framework that were fixed in 2024r1 and r2.

Here is a project that can help you track the memory leaks.
Download

Integrate the code in your project, let it run for a few hours then access the admin page to find out what is leaking.

4 Likes

I’m getting a 404?

404 on the download link or the web app itself?
If on the download link, get the attached file here

That works. Thank you very much.

Thanks! This is an expansion on what I was already doing, but very useful.