0

I just ended a major refactor in my Delphi application and wanted to compare peak memory usage between builds. Basically I need proof that the latest refactor takes less RAM that the previous build. Since the application changed so much it's hard to pinpoint an equivalent point in time to compare metrics. The best way to compare would be to know the highest memory consumption during the application execution. For example, if my application need 1 MB of RAM for the whole duration, but during 1 ms it needed 2 MB I want to get 2 MB as the result.

I started using FastMM4, but I'm not sure if it can do what I need. It can be an external tool or something I embed to my application (à la FastMM4).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
AlexV
  • 22,658
  • 18
  • 85
  • 122
  • 1
    Sounds like a job for Windows' builtin Performance Monitor tool. You can set it to monitor all kinds of performance counters over time, per process or system wide, including memory usage. – Remy Lebeau Jun 25 '20 at 03:21
  • Memory consumption is a very relative variable. If you minimize the application, it is possible that the [working set is actually trimmed](https://stackoverflow.com/questions/2115185/prevent-memory-working-set-minimize-in-console-application)... Also FastMM4 may reserve more memory space, but not actually allocate it from the HW. I wouldn't spend much time in such guess of memory consumption for a few MB. Only for a few GB, or if it starts swaping on disk, I would worrry - it may be a memory leak in practice. Windows by itself is such a memory eater anyway. :) – Arnaud Bouchez Jun 25 '20 at 07:11
  • Peak private bytes is the rift thing to check – David Heffernan Jun 25 '20 at 07:12
  • Ideally you'd need automated testing of the exact same workflow to compare between releases and always do multiple tests – Remko Jun 25 '20 at 08:11

2 Answers2

4

You can use Process Explorer.

Right-click on the top header, then use the Select Columns menu and check Peak Private Bytes from the Process Memory tab.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
dwrbudr
  • 607
  • 4
  • 8
2

Process Explorer as recommended by dwrbudr is nice, but it lacks the granularity I needed, so I ended up using FastMM4 to get the memory usage during the whole flow of each build. I just logged the values and then compared the evolution manually.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
AlexV
  • 22,658
  • 18
  • 85
  • 122