Charles Peacech 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
> 
> if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
> 
> become
> 
> void *temp = malloc(KEEP_ROOM);
> if (!temp && !releasing)
> {
>     // do something to release memory
> }
> else
> {
>     free(temp);
> }

We have located the problem in using GlobalMemoryStatus().  We can fix
it there instead of using an ugly workaround.

-- 
hundred-and-one symptoms of being an internet addict:
25. You believe nothing looks sexier than a man in boxer shorts illuminated
    only by a 17" inch svga monitor.

 /// 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

Raspunde prin e-mail lui