This should reduce the executable size quite a bit in some of my very large projects. I am sure there would be other benefits too.
EDIT: Is there perhaps a utility t
See some of the answers here.
Remember that the linker will strip anything that can't be called. If no use is made of a unit and it has no initialization or finalization it's going to be completely stripped anyway. Anything referenced in the initialization or finalization will stay but in general this shouldn't bring in much anyway.
It's possible for a unit to consist of only initialization so full-auto stripping is limited anyway. Units which merely change system behavior in some fashion might very well have no references and yet be needed. (The replacement memory manager with good leak tracking comes to mind. While it does have things you can reference there's no need to, just use it and get the leak report. Nice double-check for your code.)
If your code can be compiled with Free Pascal, the Free Pascal compiler also will emit hints about unused units in your code.
See also this SO entry with additional information about possible problems, like RTTI based methods:
https://stackoverflow.com/questions/605977/tools-to-detect-dead-code-in-delphi2007-or-above/
You might want to take a look at at CnPack.
CnPack includes a Uses cleaner wizard wich hasn't failed me yet.
I used to use Icarus that gave me a report of unused uses entries.
From the web page
ICARUS parses Delphi or Borland Pascal source code and generates a Uses Report. This report will help you remove unneeded units from your uses lists. You will also know which units that can be moved from the interface uses list to the implementation uses list.
Removing unused uses references has multiple benefits: Cleaner code to maintain, no need to bother about code that is not used Code from initialization and finalization sections in unused units is not linked in Compilation runs smoother and quicker
ICARUS is very easy to use, just select a source file, set a few options, and start analyzing. Or let the built-in wizard guide you through this process.
ICARUS is FREEWARE.
Such a tool can never analyze if the initialization or finalization sections of a used unit need to be executed or not. Removing units from the uses could result in not running initialization and finalization sections and therefore result in bugs.