summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-05-10 16:14:20 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-05-10 16:14:20 +0000
commit057c0da532eebde4f74992433769b23a0daa9362 (patch)
treef5d9730bf94ab9999d307a85c65e299e11c0163e /lib
parentd6c14bce14f39209d29d39eeeed231f717e6a137 (diff)
Use madvise(MADV_FREE) to allow the 'h' option.
(the code was already there, just not enabled).
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/malloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index ad5ce94d549..d9211e2641f 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -8,7 +8,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: malloc.c,v 1.40 2000/04/10 19:36:29 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: malloc.c,v 1.41 2001/05/10 16:14:19 art Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -243,7 +243,7 @@ static int malloc_silent;
/* always realloc ? */
static int malloc_realloc;
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || (defined(__OpenBSD__) && defined(MADV_FREE))
/* pass the kernel a hint on free pages ? */
static int malloc_hint;
#endif
@@ -547,7 +547,7 @@ malloc_init ()
case 'd': malloc_stats = 0; break;
case 'D': malloc_stats = 1; break;
#endif /* MALLOC_STATS */
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || (defined(__OpenBSD__) && defined(MADV_FREE))
case 'h': malloc_hint = 0; break;
case 'H': malloc_hint = 1; break;
#endif /* __FreeBSD__ */
@@ -1004,7 +1004,7 @@ free_pages(ptr, index, info)
if (malloc_junk)
memset(ptr, SOME_JUNK, l);
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || (defined(__OpenBSD__) && defined(MADV_FREE))
if (malloc_hint)
madvise(ptr, l, MADV_FREE);
#endif