On Sun, Jun 3, 2012 at 10:43 PM, Christian Brabandt <[email protected]> wrote: > Hi Charles! > > On So, 03 Jun 2012, Charles wrote: > >> In lalloc function, when allocating memory, mch_avail_mem is called >> for getting the free memory size. >> This function is prone with overflow. At least I'm pretty sure that I >> have been getting random >> memory allocation error from vim because this function sometimes >> overflows in windows. >> >> Wouldn't it be possible to replace it with malloc-ing a temporary >> memory. For example > > […] > > Wouldn't it than be better, to replace the GlobalMemoryStatus Function > with the GlobalMemoryStatusEx function, as you suggested earlier?
Yes, but GlobalMemoryStatusEx is supported only from Windows 2000 onwards. If we want to support Windows 98 too like vim currently does, then we need to use GlobalMemoryStatusEx or GlobalMemoryStatus based on the windows version. GlobalMemoryStatus itself has inconsistent behavior on different windows versions. In some it gives modulo 4 GB when overflowing, in others it gives -1 when overflowing. Using temporary malloc as I previously suggested is much simpler and cross platform. -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
