Charles Peacech wrote: > 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.
That's the plan, we check the windows version in several places already. > 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. Not really. Freeing temporarily allocated memory doesn't mean it is then available, modern memory allocators work in mysterious ways. -- Q: What is the difference betwee open-source and commercial software? A: If you have a problem with commercial software you can call a phone number and they will tell you it might be solved in a future version. For open-source software there isn't a phone number to call, but you get the solution within a day. /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- 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
