Catching memory leaks in Delphi: a definitive list of tools
[SHOWTOGROUPS=4,20]
Catching memory leaks in Delphi: a definitive list of tools
Detecting memory leaks is a very important task in Delphi development. I’ve Как увидеть ссылки? | How to see hidden links?, stressing that in server applications like the ones built with Как увидеть ссылки? | How to see hidden links? this is even more important.
With the Как увидеть ссылки? | How to see hidden links?, this will become even more relevant. A unified memory management Как увидеть ссылки? | How to see hidden links?, and Как увидеть ссылки? | How to see hidden links?.
As everything in life, this change isn’t 100% good or bad, Как увидеть ссылки? | How to see hidden links?, but one thing is clear: the way memory is managed now is the same in all platforms, so the ways to detect memory leaks in different platforms are more similar now. I personally think this is a good thing. It’s also important to note that this doesn’t necessarily mean “more leaks” in mobile platforms. The “old” (still valid when I’m writing this article) Как увидеть ссылки? | How to see hidden links? also had its problems, and in my opinion harder to detect, like Как увидеть ссылки? | How to see hidden links?.
But well, enough with this too long introduction. The humble purpose of this article is to be a definitive and up-to-date list of all tools that you can use to detect memory leaks in Delphi applications. Pointing out that memory management is unified just means that these tools are even more relevant than ever. Detecting and fixing a memory leak in Windows will help even more that your non-Windows applications will not have memory leaks as well.
So, to the list!
Как увидеть ссылки? | How to see hidden links? (Free)
FastMM (or to be more specific, FastMM4) is the de-facto standard tool to detect memory leaks in Delphi. The reason is simple: it’s the Как увидеть ссылки? | How to see hidden links?, so it’s already built-in and ready to use.
Since FastMM allocates and deallocates memory in your application, who else is better to report the blocks that have not been deallocated? All that it takes to start working with it is add a single line in your project:
ReportMemoryLeaksOnShutdown := True;
And voilà, your application will report all memory leaks when it shuts down. If there are leaks at the end of your application, a dialog will be displayed showing all the leaks.
All Delphi developers should add that line to their applications. Really. I don’t even know why this is not added by default in Delphi, at least wrapped by a {$IFDEF DEBUG} directive. Maybe for historical reasons.
So, if it’s built-in, default, works, why don’t we finish this article here, then? Well, there are some gotchas.
Delphi includes a stripped out version of FastMM4. It doesn’t have all the nice debugging tools you need (to know, for example, where in the code your leaked memory was allocated). To do that, you have to use the full FastMM4 version, available on the Как увидеть ссылки? | How to see hidden links?.
You also have to use a DLL for the full debugging features; it’s not cross-platform: it only officially works for Windows (it looks like a macOS version is available in the official repo, but I never tried it). And even though it has lots of features, to use it Как увидеть ссылки? | How to see hidden links?, which might not be comfortable for some users.
But all in all, is a great tool, the “standard” tool to get memory leaks in Delphi. (Side note: Как увидеть ссылки? | How to see hidden links?. We haven’t tested it yet but it looks like it brings a Как увидеть ссылки? | How to see hidden links?, we can’t wait to test it in TMS XData.)
Pros
Как увидеть ссылки? | How to see hidden links? (Free)
Delphi LeakCheck is another great option for detecting memory leaks. It’s also free, open source, and has some advantages over FastMM: it’s cross-platform, meaning you can check leaks directly in mobile and Linux applications; and it integrates very well with unit test frameworks (namely Как увидеть ссылки? | How to see hidden links? and Как увидеть ссылки? | How to see hidden links?).
The way to get started with it is similar to FastMM: add LeakCheck unit as the first used unit in your dpr uses clause, and it will plugin and be ready to use. Setting up for unit testing is a little more complicated though, but that’s part of the game.
One small disadvantage is that to use it you are almost on your own: the project hasn’t received updates for a while (which isn’t necessarily bad since it’s working). But that means probably you won’t get much help directly from the author (I never tried, to be fair). There is also not much information about it in the web, I just found one Как увидеть ссылки? | How to see hidden links?t besides the detailed description in the official Bitbucket repository itself.
Pros
Как увидеть ссылки? | How to see hidden links? (Commercial)
Delaker is the only commercial tool in the list that is exclusively dedicated to catch memory leaks. That reflects in the product, which provides you with really nice features for detecting memory leaks.
Differently from the previous two tools, and similar to the following ones, it has a friendly GUI for you to setup the environment and see the results, which can be used standalone or integrated to Delphi IDE. It can also detect way more types of memory leaks: GDI leaks, leaks of Windows USER objects and handles, leaks in Windows APIs, in 3rd party DLLs, etc. Exactly because of that, it provides options for you to easily ignore several types of leaks – if you don’t, you will get a gazillion of leaks in just a regular app execution.
Another nice feature is the ability to take snapshots of the memory allocation. This allows you to detect leaks not only during the lifetime of your whole application, but in some specific operations of it.
Pros
[/SHOWTOGROUPS]
Catching memory leaks in Delphi: a definitive list of tools
Detecting memory leaks is a very important task in Delphi development. I’ve Как увидеть ссылки? | How to see hidden links?, stressing that in server applications like the ones built with Как увидеть ссылки? | How to see hidden links? this is even more important.
With the Как увидеть ссылки? | How to see hidden links?, this will become even more relevant. A unified memory management Как увидеть ссылки? | How to see hidden links?, and Как увидеть ссылки? | How to see hidden links?.
As everything in life, this change isn’t 100% good or bad, Как увидеть ссылки? | How to see hidden links?, but one thing is clear: the way memory is managed now is the same in all platforms, so the ways to detect memory leaks in different platforms are more similar now. I personally think this is a good thing. It’s also important to note that this doesn’t necessarily mean “more leaks” in mobile platforms. The “old” (still valid when I’m writing this article) Как увидеть ссылки? | How to see hidden links? also had its problems, and in my opinion harder to detect, like Как увидеть ссылки? | How to see hidden links?.
But well, enough with this too long introduction. The humble purpose of this article is to be a definitive and up-to-date list of all tools that you can use to detect memory leaks in Delphi applications. Pointing out that memory management is unified just means that these tools are even more relevant than ever. Detecting and fixing a memory leak in Windows will help even more that your non-Windows applications will not have memory leaks as well.
So, to the list!
Как увидеть ссылки? | How to see hidden links? (Free)

FastMM (or to be more specific, FastMM4) is the de-facto standard tool to detect memory leaks in Delphi. The reason is simple: it’s the Как увидеть ссылки? | How to see hidden links?, so it’s already built-in and ready to use.
Since FastMM allocates and deallocates memory in your application, who else is better to report the blocks that have not been deallocated? All that it takes to start working with it is add a single line in your project:
ReportMemoryLeaksOnShutdown := True;
And voilà, your application will report all memory leaks when it shuts down. If there are leaks at the end of your application, a dialog will be displayed showing all the leaks.

All Delphi developers should add that line to their applications. Really. I don’t even know why this is not added by default in Delphi, at least wrapped by a {$IFDEF DEBUG} directive. Maybe for historical reasons.
So, if it’s built-in, default, works, why don’t we finish this article here, then? Well, there are some gotchas.
Delphi includes a stripped out version of FastMM4. It doesn’t have all the nice debugging tools you need (to know, for example, where in the code your leaked memory was allocated). To do that, you have to use the full FastMM4 version, available on the Как увидеть ссылки? | How to see hidden links?.
You also have to use a DLL for the full debugging features; it’s not cross-platform: it only officially works for Windows (it looks like a macOS version is available in the official repo, but I never tried it). And even though it has lots of features, to use it Как увидеть ссылки? | How to see hidden links?, which might not be comfortable for some users.
But all in all, is a great tool, the “standard” tool to get memory leaks in Delphi. (Side note: Как увидеть ссылки? | How to see hidden links?. We haven’t tested it yet but it looks like it brings a Как увидеть ссылки? | How to see hidden links?, we can’t wait to test it in TMS XData.)
Pros
- Free;
- Full source code;
- Built-in in Delphi;
- Easy to setup;
- Lots of advanced features.
- Windows only;
- Needs external DLL for debugging features;
- Not user-friendly to setup and use advanced features (no built-in GUI);
- Only reports leaks on memory allocated by FASTMM itself.
Как увидеть ссылки? | How to see hidden links? (Free)
Delphi LeakCheck is another great option for detecting memory leaks. It’s also free, open source, and has some advantages over FastMM: it’s cross-platform, meaning you can check leaks directly in mobile and Linux applications; and it integrates very well with unit test frameworks (namely Как увидеть ссылки? | How to see hidden links? and Как увидеть ссылки? | How to see hidden links?).
The way to get started with it is similar to FastMM: add LeakCheck unit as the first used unit in your dpr uses clause, and it will plugin and be ready to use. Setting up for unit testing is a little more complicated though, but that’s part of the game.
One small disadvantage is that to use it you are almost on your own: the project hasn’t received updates for a while (which isn’t necessarily bad since it’s working). But that means probably you won’t get much help directly from the author (I never tried, to be fair). There is also not much information about it in the web, I just found one Как увидеть ссылки? | How to see hidden links?t besides the detailed description in the official Bitbucket repository itself.
Pros
- Free;
- Full source code;
- Cross-plataform;
- Integrates well with unit testing (DUnit and DUnitX).
- Not much information around about how to use it;
- No recent updates, no official support;
Как увидеть ссылки? | How to see hidden links? (Commercial)

Delaker is the only commercial tool in the list that is exclusively dedicated to catch memory leaks. That reflects in the product, which provides you with really nice features for detecting memory leaks.

Differently from the previous two tools, and similar to the following ones, it has a friendly GUI for you to setup the environment and see the results, which can be used standalone or integrated to Delphi IDE. It can also detect way more types of memory leaks: GDI leaks, leaks of Windows USER objects and handles, leaks in Windows APIs, in 3rd party DLLs, etc. Exactly because of that, it provides options for you to easily ignore several types of leaks – if you don’t, you will get a gazillion of leaks in just a regular app execution.
Another nice feature is the ability to take snapshots of the memory allocation. This allows you to detect leaks not only during the lifetime of your whole application, but in some specific operations of it.
Pros
- Friendly GUI that can be used standalone or integrated into Delphi IDE;
- Detects all types of leaks;
- Command-line tool for CI integration;
- Memory usage snapshots;
- Official support;
- Paid license ($99 for Home License, $399 for Single Developer License);
- Windows only;
[/SHOWTOGROUPS]