Huge memory consumption with Windows app built with 2021R3

As I was working on adapting my app to the new Windows Dark Mode, I noticed that my app uses 1.4 GB of memory when run in debug or build mode. Also my app is sluggish.

The same code built with 2021R1 uses 550 MB of memory. I was quite a bit shocked by the difference.

Has anything changed in the way the apps consume memory or render when compiled with 2021R3?

I do remember just a huge memory leak found during tests on iOS tied to the paint event (fixed and not present in the released R3). On Windows I don’t remember. If leaks are occurring, I’m very interested in knowing them. I always ask users the minimum of 4Gb of RAM, but some even try by themselves to use apps on 2GB systems. A 1.4GB consumption from start means a crash waiting to happen.

Compressed PNG images comes to mind. Maybe unrelated with such case.

That was only for the icons when saving your project to disk. It does not affect built or running apps.

I’m very interested in those supposed leaks related to the release, it may suspend my migration path for R3.

After spending a bit of time on it,. the huge increase in memory seems to come from the WebKit HTMLViewer update.

When the app built with 2021R1 is run, it uses about 250 MB and. It also runs 14 cefsubpro which uses about 20 MB each.

When the app built with 2021R3 is launched, it uses 500 MB and then 250 MB a few minutes later. it also runs 16 cefsubpro (why 16 ?) which uses about 50 MB each. But then later, they use about 20 MB each.

Do you have “many” HTMLViewer controls open at the same time?

Maybe Implicit instance is on for such windows, that would have them all in memory…?

Only if those windows were open, so the controls there would be instantiated at such time.

If by open you mean instantiated then yes. at least 11 on the main window. They are inside container controls which are placed on the main window.

Why do they use about 20 MB with 2021R1 and about 50 MB with 2021R3 ?

You said it decreases to 20MB. I don’t know, maybe some 30MB transient allocation from the engine for some startup reason and later some kind of “garbage collected” as soon as it notices the content sent to it was not as big as it could potentially be and freed an excess.

After reading about transient allocation, it makes sense.

So, the questions for me are “would the end user notice this temporary memory peak and would he care about it ?”

In your case you should try and find out. Run it in a VM with limited memory to see if uses virtual memory or crashes.