From: Paul Eggert <eggert@cs.ucla.edu>
To: Donald Ephraim Curtis <dcurtis@gmail.com>
Cc: 8800@debbugs.gnu.org, Emacs Development <Emacs-devel@gnu.org>
Subject: bug#8800: Compilation error caused by SPARE_MEMORY
Date: Mon, 06 Jun 2011 09:42:29 -0700 [thread overview]
Message-ID: <4DED0375.9010006@cs.ucla.edu> (raw)
In-Reply-To: <E1FBFBBC-7AAF-438A-B779-E20053811484@gmail.com>
On 06/06/11 05:02, Donald Ephraim Curtis wrote:
> shouldn't there still be a check to see if SPARE_MEMORY is defined already?
If SYSTEM_MALLOC is not defined, SPARE_MEMORY must be defined,
so the code is OK. This can be seen by looking at the larger context
in alloc.c. However, I can see that the code is confusing, so
I simplified it this way:
* alloc.c: Simplify handling of large-request failures (Bug#8800).
(SPARE_MEMORY): Always define.
(LARGE_REQUEST): Remove.
(memory_full): Use SPARE_MEMORY rather than LARGE_REQUEST.
=== modified file 'src/alloc.c'
--- src/alloc.c 2011-06-06 04:54:23 +0000
+++ src/alloc.c 2011-06-06 16:39:06 +0000
@@ -190,17 +190,10 @@
static char *spare_memory[7];
-#ifndef SYSTEM_MALLOC
-/* Amount of spare memory to keep in large reserve block. */
+/* Amount of spare memory to keep in large reserve block, or to see
+ whether this much is available when malloc fails on a larger request. */
#define SPARE_MEMORY (1 << 14)
-#endif
-
-#ifdef SYSTEM_MALLOC
-# define LARGE_REQUEST (1 << 14)
-#else
-# define LARGE_REQUEST SPARE_MEMORY
-#endif
/* Number of extra blocks malloc should get when it needs more core. */
@@ -3289,9 +3282,9 @@
{
/* Do not go into hysterics merely because a large request failed. */
int enough_free_memory = 0;
- if (LARGE_REQUEST < nbytes)
+ if (SPARE_MEMORY < nbytes)
{
- void *p = malloc (LARGE_REQUEST);
+ void *p = malloc (SPARE_MEMORY);
if (p)
{
free (p);
next prev parent reply other threads:[~2011-06-06 16:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-05 21:10 Compilation error caused by SPARE_MEMORY Ben Key
2011-06-05 21:54 ` Glenn Morris
2011-06-06 4:59 ` Paul Eggert
2011-06-06 12:02 ` Donald Ephraim Curtis
2011-06-06 16:42 ` Paul Eggert [this message]
2011-06-06 2:50 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DED0375.9010006@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=8800@debbugs.gnu.org \
--cc=Emacs-devel@gnu.org \
--cc=dcurtis@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).