[英]Debug information {$D+} increases the size of my EXE with 6MB
Delphi documentation says that "Debug information [...] it does not affect the size or speed of the executable program." Delphi 文档说“调试信息 [...] 它不会影响可执行程序的大小或速度。”
However, when I activate Debug information (in Project Options -> Linker) my EXE goes from 1.8MB to 7MB.但是,当我激活调试信息(在项目选项 -> 链接器中)时,我的 EXE 从 1.8MB 变为 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} ).注意:我认为“链接”下的“调试信息”与“编译”下的“调试信息”相同,因为它们具有相同的编译器指令( {$D} )。
Your assumption is incorrect.你的假设是不正确的。 Compiling with debug information means that the compiler generates DCUs with debug information.使用调试信息编译意味着编译器生成带有调试信息的 DCU。 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.与调试信息链接意味着 linker 将来自 DCU 的调试信息放入最终的二进制文件中,而不是将其剥离出来,因此这当然会使二进制文件变得更大。
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.没有调试信息的链接通常是可以的,因为调试器可以获取 DCU 中的调试信息,只要它可以找到它们。 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.但是,如果您需要在 DCU 不可用的某些情况下调试您的应用程序,您需要打开链接选项。
Adding debug information won't impact the code size (the code generated is the same with the option on or off, other options control code generation), but will impact the file size.添加调试信息不会影响代码大小(生成的代码与选项打开或关闭相同,其他选项控制代码生成),但会影响文件大小。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.