DOS/4GW Fatal Error (1307): not enough memory

DOS/4GW Fatal Error (1307): not enough memory

我正尝试在 Win7 32 位 OS 中 运行 一个 dos/4gw 应用程序。我收到以下错误消息, DOS/4GW fatal error (1307): not enough memory

当我 运行 在 WinXP 32 位 OS 中使用相同的应用程序时,它工作正常,没有任何问题。

dos/4gw 应用程序是使用 Watcom C 编译器构建的。

mem 命令显示以下可用内存,

655360 bytes total conventional memory 655360 bytes available to MS-DOS 580640 largest executable program size 16777216 bytes total EMS memory 16777216 bytes free EMS memory 32505856 bytes total contiguous extended memory 0 bytes available contiguous extended memory 15580160 bytes available XMS memory MS-DOS resident in High Memory Area

从上面可以看出内存不足1MB。但是我的程序需要的不止于此。基本上,我需要扩展我的 DOS 内存,以便为 运行 宁我的 dos/4gw 应用程序获得超过 1MB 的内存。

任何人都可以帮助解决这个内存问题吗?

谢谢!

-阿南德

问题的答案是doynax的回复:

"I believe there is a shim in recent versions of Windows limiting the available DPMI memory to 32 MB, for yet more ancient software incapable of unprepared such wast quantities of RAM. You may try creating a DpmiLimit key under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WOW in the registry to adjust this with the limit in bytes as a DWORD"

我想帮助保存此设置的原因,以免它消失在历史中。

简短版本:损坏的 DOS 扩展程序使用 16 位有符号整数。任何大于 32,768 字节 (32 MB) 的内容都会导致它们失败。


Thomas R. Nicely 在 2007 年 post 指出了问题所在:

Windows Vista restricts non-Win32 apps to 32 MB of memory (archive)

然后 there's a 2010 usenet post that reminds 我们认为操作系统限制了 DPMI 可用的内存量:


I recently came across Thomas R. Nicely's WWW page on Windows Vista's DPMI server. It's pretty confused. (These people have some quite sensible things to say on the matter of M. Nicely's page.) And no wonder that it is, if this was how you explained things to M. Nicely, as xe claims you did. (-:

This DPMI server limit is another case in point, as a matter of fact. M. Nicely presents this as some sort of mysterious conspiracy against gcc. In actual fact, as pointed out by M. bwakaz, it's simple defence against all of the stupid and broken things that DPMI-based extended DOS applications are known to do, such as allocating all of the memory that is available at program startup, because they are badly written. M. bwakaz points to an article by Raymond Chen that anyone wanting to understand this should read.

This DpmiLimit setting that you mentioned is in fact nothing new. It's simply undocumented on Windows NT 6. OS/2 VDM's have had a documented DPMI memory limit setting for almost two decades. The setting is DPMI_MEMORY_LIMIT. You can read on Usenet and the WWW hundreds of discussions of this, going back to about 1994, and the reasons for tweaking it up and down. On an OS/2 system one can open up a VDM settings notebook, and obtain on-line help describing the setting.

Raymond Chen singles out DOS games as some of the particular offenders when it comes to abusing DPMI, and there's a whole FAQ for running DOS games under OS/2 that lists the various different DPMI_MEMORY_LIMIT (and other) settings for getting such games to play nicely with the operating system and not chew up memory unnecessarily, just because the DPMI server in the VDM would otherwuse allow them to.

Again, NTVDM isn't being "weird", at all. It's implementing a setting, and a limit, that is par for the course in Virtual DOS Machines. Even the default of 32MiB isn't unusual. The default for DPMI_MEMORY_LIMIT in OS/2 VDMs was (in recent versions of OS/2, if memory serves) 64MiB. If you read Raymond Chen's article all of the way to the end, there's even an explanation of why such values are the defaults: It's to cope with the broken extended DOS programs that measure available DPMI memory in KiB using 16-bit integers. (NTVDM's default assumes signed 16-bit integers. OS/2's VDM default assumes unsigned 16-bit integers.)

All of these things — be they traps into the VM monitor from inside the VDM, or DPMI server limits to control badly written DOS programs — aren't NTVDM being "weird" or unusual, or secret conspiracies by Microsoft against people who think that compiling with gcc means that one is compiling extended DOS programs. They're simple long-standing practice for VDMs, and run-of-the-mill stuff for virtual machine technology that goes back for decades.