问题描述
我之前使用过 UPX 来减小我的 Windows 可执行文件的大小,但我必须承认我我对这可能产生的任何负面影响感到天真.所有这些打包/拆包的缺点是什么?
I've used UPX before to reduce the size of my Windows executables, but I must admit that I am naive to any negative side effects this could have. What's the downside to all of this packing/unpacking?
在某些情况下,是否有人会建议不要对可执行文件进行 UPX 处理(例如,在编写 DLL、Windows 服务时,或针对 Vista 或 Win7 时)?我的大部分代码都是用 Delphi 编写的,但我也使用 UPX 来压缩 C/C++ 可执行文件.
Are there scenarios in which anyone would recommend NOT UPX-ing an executable (e.g. when writing a DLL, Windows Service, or when targeting Vista or Win7)? I write most of my code in Delp but I've used UPX to compress C/C++ executables as well.
附带说明一下,我不运行 UPX 是为了保护我的 exe 免受反汇编程序的攻击,只是为了减小可执行文件的大小并防止粗略篡改.
On a side note, I'm not running UPX in some attempt to protect my exe from disassemblers, only to reduce the size of the executable and prevent cursory tampering.
推荐答案
在启动一个压缩的 EXE/DLL 时,所有的代码都是从磁盘映像解压到一次性记忆,这可能会导致如果系统低,则磁盘抖动内存并被强制访问交换文件.与...对比未压缩的 EXE/DLL,操作系统为代码页分配内存需求(即执行时).
Upon startup of a compressed EXE/DLL, all of the code is decompressed from the disk image into memory in one pass, which can cause disk thrashing if the system is low on memory and is forced to access the swap file. In contrast, with uncompressed EXE/DLLs, the OS allocates memory for code pages on demand (i.e. when they are executed).
压缩的 EXE/DLL 的多个实例创建多个内存中的代码实例.如果你有一个压缩的 EXE包含 1 MB 的代码(之前压缩),用户开始 5它的实例,大约 4 MB内存被浪费了.同样,如果你有一个 1 MB 的 DLL 并被使用通过 5 个正在运行的应用程序,大约 4 MB 的内存是浪费了.使用未压缩的 EXE/DLL,代码只存储在内存中一次并且在实例之间共享.
Multiple instances of a compressed EXE/DLL create multiple instances of the code in memory. If you have a compressed EXE that contains 1 MB of code (before compression) and the user starts 5 instances of it, approximately 4 MB of memory is wasted. Likewise, if you have a DLL that is 1 MB and it is used by 5 running applications, approximately 4 MB of memory is wasted. With uncompressed EXE/DLLs, code is only stored in memory once and is shared between instances.
http://www.jrsoftware.org/striprlc.php#execomp
这篇关于使用 UPX 压缩 Windows 可执行文件有什么缺点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!