简体   繁体   English

调试信息 {$D+} 将我的 EXE 的大小增加了 6MB

[英]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.

相关问题 Delphi 2007 EXE 和 C++ DLL:调试输出:027D4FF8 处的堆块在 027D5009 处修改,超过了请求的 9 进程大小 - Delphi 2007 EXE and C++ DLL: Debug Output: Heap block at 027D4FF8 modified at 027D5009 past requested size of 9 Process 防止枚举类型数组的调试信息出现在 EXE 中 - Prevent debug information for array of enumerated type from appearing in EXE 什么是'有限的调试信息'? (完整的“调试信息”生成巨大的EXE文件) - What is 'Limited Debug Information'? (Full “Debugging Information" generates huge EXE files) 用于发布的Delphi项目的MSBuild仍设置D +选项 - MSBuild of Delphi project for RELEASE still sets D+ option 如何调试.exe在Delphi中由另一个.exe启动 - How to debug .exe started by another .exe in Delphi 为什么我的D2009 exe会生成带有名为ATTnnnnn.DAT的附件的电子邮件 - why does my D2009 exe produce emails with attachments named ATTnnnnn.DAT Delphi:带内置软件包的.exe:600kb,.exe +外部BPL:6MB。这是为什么? - Delphi: .exe with built-in packages: 600kb, .exe + external BPLs: 6MB. Why is that? 轻松获取应用程序exe大小 - Get Application exe size easily 编译时修改EXE中的版本信息 - Modify version information in EXE at compile time 是否可以从DCU中剥离调试信息? - Is it possible to strip Debug Information from DCUs?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM