diff options
| author | Eli Zaretskii | 2008-08-24 19:06:36 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2008-08-24 19:06:36 +0000 |
| commit | 8a445f762f0acc4aa6276a92bed5efbfaa78c3bc (patch) | |
| tree | 96a83bea3ebab19255bee1111527ebee5fd3f15e | |
| parent | c5e2611e3e21c705cf222c2138516ea6dfc7d8ec (diff) | |
| download | emacs-8a445f762f0acc4aa6276a92bed5efbfaa78c3bc.tar.gz emacs-8a445f762f0acc4aa6276a92bed5efbfaa78c3bc.zip | |
(get_lim_data) [MSDOS]: Use alternative methods of estimating available memory.
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/vm-limit.c | 22 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6d04d426998..89921e7b395 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2008-08-24 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * vm-limit.c (get_lim_data) [MSDOS]: Use alternative methods of | ||
| 4 | estimating available memory. | ||
| 5 | |||
| 1 | 2008-08-23 David Reitter <david.reitter@gmail.com> | 6 | 2008-08-23 David Reitter <david.reitter@gmail.com> |
| 2 | 7 | ||
| 3 | * nsterm.m (ns_draw_window_cursor): Don't call | 8 | * nsterm.m (ns_draw_window_cursor): Don't call |
diff --git a/src/vm-limit.c b/src/vm-limit.c index f80e5c47604..907732c82af 100644 --- a/src/vm-limit.c +++ b/src/vm-limit.c | |||
| @@ -121,9 +121,29 @@ void | |||
| 121 | get_lim_data () | 121 | get_lim_data () |
| 122 | { | 122 | { |
| 123 | _go32_dpmi_meminfo info; | 123 | _go32_dpmi_meminfo info; |
| 124 | unsigned long lim1, lim2; | ||
| 124 | 125 | ||
| 125 | _go32_dpmi_get_free_memory_information (&info); | 126 | _go32_dpmi_get_free_memory_information (&info); |
| 126 | lim_data = info.available_memory; | 127 | /* DPMI server of Windows NT and its descendants reports in |
| 128 | info.available_memory a much lower amount that is really | ||
| 129 | available, which causes bogus "past 95% of memory limit" | ||
| 130 | warnings. Try to overcome that via circumstantial evidence. */ | ||
| 131 | lim1 = info.available_memory; | ||
| 132 | lim2 = info.available_physical_pages * 4096; | ||
| 133 | /* DPMI Spec: "Fields that are unavailable will hold -1." */ | ||
| 134 | if ((long)lim1 == -1L) | ||
| 135 | lim1 = 0; | ||
| 136 | if ((long)lim2 == -1L) | ||
| 137 | lim2 = 0; | ||
| 138 | /* Surely, the available memory is at least what we have physically | ||
| 139 | available, right? */ | ||
| 140 | if (lim1 > lim2) | ||
| 141 | lim_data = lim1; | ||
| 142 | else | ||
| 143 | lim_data = lim2; | ||
| 144 | /* Don't believe they will give us more that 0.5 GB. */ | ||
| 145 | if (lim_data > 512 * 1024 * 1024) | ||
| 146 | lim_data = 512 * 1024 * 1024; | ||
| 127 | } | 147 | } |
| 128 | #else /* not MSDOS */ | 148 | #else /* not MSDOS */ |
| 129 | static void | 149 | static void |