What could explain the difference in memory usage reported by FastMM or GetProcessMemoryInfo?

My Delphi XE application is based on a single EXE using the local server DLL created by RemObjects and uses large memory for a specific operation until it throws an exception because there is not enough memory. Therefore, I am trying to understand why and where this is happening, so I put various steps in my code where I report memory usage. The problem is that I get completely different information based on the method used to get information about memory usage:

It seems that the second method is the correct one based on memory problems, but how can the FastMM method be so "low"? And what can explain the difference?

+3
source share
1 answer

GetProcessMemoryInfo also writes memory that is not managed by FastMM, such as memory that is allocated by various non-Delphi DLLs that you might call (e.g. winapi).

FastMM can also allocate more memory from Windows, which your application actually uses for internal structures, fragmentation, and integration.

And as the last time, using GetProcessMemoryInfo you measure the size of a Workingset. This is that part of the application memory is currenctly in RAM, not in the page file. It includes more than just data structures and is definitely not comparable to the shared memory allocated by the application. PagefileUsage will be more comparable. The size of the working set is almost never what you are looking for. See here for more details.

Thus, they give different results, because both of them measure different things.

+5
source

Source: https://habr.com/ru/post/1401608/


All Articles