[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 918a2dd: Use hybrid malloc for FreeBSD (Bug#28308
From: |
Noam Postavsky |
Subject: |
[Emacs-diffs] emacs-26 918a2dd: Use hybrid malloc for FreeBSD (Bug#28308) |
Date: |
Sat, 4 Nov 2017 19:06:15 -0400 (EDT) |
branch: emacs-26
commit 918a2dda07ebf16601a93d0464f62c4e846d8b39
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Use hybrid malloc for FreeBSD (Bug#28308)
FreeBSD aarch64 does not provide sbrk, so gmalloc cannot be used; when
using system malloc dumping does not work correctly (allocated data is
invalid after dumping).
* configure.ac: Set hybrid_malloc for freebsd.
* src/gmalloc.c (gdefault_morecore) [!HAVE_SBRK]: Don't call sbrk.
---
configure.ac | 2 +-
src/gmalloc.c | 11 ++++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index d397e8f..5579342 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2218,7 +2218,7 @@ test "$CANNOT_DUMP" = yes ||
case "$opsys" in
## darwin ld insists on the use of malloc routines in the System framework.
darwin | mingw32 | nacl | sol2-10) ;;
- cygwin | qnxto)
+ cygwin | qnxto | freebsd)
hybrid_malloc=yes
system_malloc= ;;
*) test "$ac_cv_func_sbrk" = yes &&
system_malloc=$emacs_cv_sanitize_address;;
diff --git a/src/gmalloc.c b/src/gmalloc.c
index 2bda95e..a17d39c 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -1502,17 +1502,18 @@ extern void *__sbrk (ptrdiff_t increment);
static void *
gdefault_morecore (ptrdiff_t increment)
{
- void *result;
#ifdef HYBRID_MALLOC
if (!DUMPED)
{
return bss_sbrk (increment);
}
#endif
- result = (void *) __sbrk (increment);
- if (result == (void *) -1)
- return NULL;
- return result;
+#ifdef HAVE_SBRK
+ void *result = (void *) __sbrk (increment);
+ if (result != (void *) -1)
+ return result;
+#endif
+ return NULL;
}
void *(*__morecore) (ptrdiff_t) = gdefault_morecore;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 918a2dd: Use hybrid malloc for FreeBSD (Bug#28308),
Noam Postavsky <=