Jelle Geerts wrote:
> When allocating memory, lalloc() is called, which uses
> mch_avail_mem(). But mch_avail_mem() sometimes fails. It returns the
> available physical memory + available page file memory, which can
> sometimes wrap around 32-bits.
>
> Also, mch_avail_mem() uses GlobalMemoryStatus() which isn't working
> properly on computers with more than 4 GiB of memory installed. There
> is an extension available on NT platforms 0x0500, called
> GlobalMemoryStatusEx(). As opposed to GlobalMemoryStatus(), the
> extension works reliably with systems that have more than 4 GiB of
> memory installed.
>
> Please see the attachment for the diff file for my patch. If the
> comments I have added are too wordy or someone does not like them,
> just remove them ;)
Thanks for looking into this. The comment is confusing: returning
non-zero for failure. The result is always non-zero.
I build one binary for all systems. So the choice for the function to
call must be done at runtime, not a build time. There are a few
examples of using the system version. You will need to find out on what
systems GlobalMemoryStatusEx() is available.
Looking at this code I wonder why we add the pagefile space. The whole
idea of this mch_avail_mem() is to find out how much fits in memory, so
that we can decide when to start using the swap file.
--
I think that you'll agree that engineers are very effective in their social
interactions. It's the "normal" people who are nuts.
(Scott Adams - The Dilbert principle)
/// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---