aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/misc2.c36
-rw-r--r--src/option.c13
2 files changed, 5 insertions, 44 deletions
diff --git a/src/misc2.c b/src/misc2.c
index e8bb0c6522..154b610b13 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -599,13 +599,6 @@ int leftcol_changed(void)
*/
/*
- * Some memory is reserved for error messages and for being able to
- * call mf_release_all(), which needs some memory for mf_trans_add().
- */
-# define KEEP_ROOM (2 * 8192L)
-#define KEEP_ROOM_KB (KEEP_ROOM / 1024L)
-
-/*
* Note: if unsigned is 16 bits we can only allocate up to 64K with alloc().
* Use lalloc for larger blocks.
*/
@@ -665,9 +658,6 @@ char_u *lalloc(long_u size, int message)
char_u *p; /* pointer to new storage space */
static int releasing = FALSE; /* don't do mf_release_all() recursive */
int try_again;
-#if defined(HAVE_AVAIL_MEM) && !defined(SMALL_MEM)
- static long_u allocated = 0; /* allocated since last avail check */
-#endif
/* Safety check for allocating zero bytes */
if (size == 0) {
@@ -682,33 +672,9 @@ char_u *lalloc(long_u size, int message)
* if some blocks are released call malloc again.
*/
for (;; ) {
- /*
- * Handle three kind of systems:
- * 1. No check for available memory: Just return.
- * 2. Slow check for available memory: call mch_avail_mem() after
- * allocating KEEP_ROOM amount of memory.
- * 3. Strict check for available memory: call mch_avail_mem()
- */
if ((p = (char_u *)malloc((size_t)size)) != NULL) {
-#ifndef HAVE_AVAIL_MEM
- /* 1. No check for available memory: Just return. */
+ /* No check for available memory: Just return. */
goto theend;
-#else
-# ifndef SMALL_MEM
- /* 2. Slow check for available memory: call mch_avail_mem() after
- * allocating (KEEP_ROOM / 2) amount of memory. */
- allocated += size;
- if (allocated < KEEP_ROOM / 2)
- goto theend;
- allocated = 0;
-# endif
- /* 3. check for available memory: call mch_avail_mem() */
- if (mch_avail_mem(TRUE) < KEEP_ROOM_KB && !releasing) {
- free((char *)p); /* System is low... no go! */
- p = NULL;
- } else
- goto theend;
-#endif
}
/*
* Remember that mf_release_all() is being called to avoid an endless
diff --git a/src/option.c b/src/option.c
index 1bbd331816..72c3f2b7d0 100644
--- a/src/option.c
+++ b/src/option.c
@@ -2024,25 +2024,20 @@ void set_init_1(void)
*/
opt_idx = findoption((char_u *)"maxmemtot");
if (opt_idx >= 0) {
-#if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
+#ifndef HAVE_TOTAL_MEM
if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L)
#endif
{
-#ifdef HAVE_AVAIL_MEM
- /* Use amount of memory available at this moment. */
- n = (mch_avail_mem(FALSE) >> 1);
-#else
-# ifdef HAVE_TOTAL_MEM
+#ifdef HAVE_TOTAL_MEM
/* Use amount of memory available to Vim. */
n = (mch_total_mem(FALSE) >> 1);
-# else
+#else
n = (0x7fffffff >> 11);
-# endif
#endif
options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
opt_idx = findoption((char_u *)"maxmem");
if (opt_idx >= 0) {
-#if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
+#ifndef HAVE_TOTAL_MEM
if ((long)options[opt_idx].def_val[VI_DEFAULT] > (long)n
|| (long)options[opt_idx].def_val[VI_DEFAULT] == 0L)
#endif