Delphi documentation says that
“Debug information […] it does not affect the size or speed of the executable program.”
However, when I activate Debug information (in Project Options -> Linker) my EXE goes from 1.8MB to 7MB.
What am I doing wrong?
Note: I suppose that the ‘Debug information’ under ‘Linking’ is the same as ‘Debug information’ under ‘Compiling’ since they have the same compiler directive ( {$D} ).
Your assumption is incorrect. Compiling with debug information means that the compiler generates DCUs with debug information. Linking with debug information means that the linker puts the debug info from the DCUs into the final binary instead of stripping it out, so of course that will make the binary a lot bigger.
Linking without debug info is usually OK, since the debugger can get at the debug info in the DCUs as long as it can find them. But if you need to debug your app in some scenario where the DCUs won’t be available, you’ll want the link option turned on.