diff options
author | otto <> | 2008-11-20 09:05:15 +0000 |
---|---|---|
committer | otto <> | 2008-11-20 09:05:15 +0000 |
commit | 4483ecc8aa0fe10a3c5ed81f2f06c03dfbc1241c (patch) | |
tree | 82af5aa417179a8a3e792363cdaa21452cae7316 /src | |
parent | de05fd5cc686a37e4bbe61aed81be17ef6ff613a (diff) | |
download | openbsd-4483ecc8aa0fe10a3c5ed81f2f06c03dfbc1241c.tar.gz openbsd-4483ecc8aa0fe10a3c5ed81f2f06c03dfbc1241c.tar.bz2 openbsd-4483ecc8aa0fe10a3c5ed81f2f06c03dfbc1241c.zip |
move allocations between half a page and a page as close to the end of
the page as possible (i.e. make malloc option P a default).
ok art@ millert@ krw@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/stdlib/malloc.3 | 5 | ||||
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3 index a6a8014433..79d36d61fd 100644 --- a/src/lib/libc/stdlib/malloc.3 +++ b/src/lib/libc/stdlib/malloc.3 | |||
@@ -30,9 +30,9 @@ | |||
30 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 30 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
31 | .\" SUCH DAMAGE. | 31 | .\" SUCH DAMAGE. |
32 | .\" | 32 | .\" |
33 | .\" $OpenBSD: malloc.3,v 1.56 2008/11/02 14:42:01 otto Exp $ | 33 | .\" $OpenBSD: malloc.3,v 1.57 2008/11/20 09:05:15 otto Exp $ |
34 | .\" | 34 | .\" |
35 | .Dd $Mdocdate: November 2 2008 $ | 35 | .Dd $Mdocdate: November 20 2008 $ |
36 | .Dt MALLOC 3 | 36 | .Dt MALLOC 3 |
37 | .Os | 37 | .Os |
38 | .Sh NAME | 38 | .Sh NAME |
@@ -254,6 +254,7 @@ Freed chunks are filled with 0xdf. | |||
254 | Allocations larger than half a page but smaller that a page | 254 | Allocations larger than half a page but smaller that a page |
255 | are aligned to the end of a page to catch buffer overruns in more | 255 | are aligned to the end of a page to catch buffer overruns in more |
256 | cases. | 256 | cases. |
257 | This is the default. | ||
257 | .It Cm R | 258 | .It Cm R |
258 | .Dq realloc . | 259 | .Dq realloc . |
259 | Always reallocate when | 260 | Always reallocate when |
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 4e33d33b1b..0f1f088b44 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: malloc.c,v 1.109 2008/11/20 09:01:24 otto Exp $ */ | 1 | /* $OpenBSD: malloc.c,v 1.110 2008/11/20 09:05:15 otto Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> |
4 | * | 4 | * |
@@ -154,7 +154,7 @@ static int malloc_active; /* status of malloc */ | |||
154 | static int malloc_freeprot; /* mprotect free pages PROT_NONE? */ | 154 | static int malloc_freeprot; /* mprotect free pages PROT_NONE? */ |
155 | static int malloc_hint; /* call madvice on free pages? */ | 155 | static int malloc_hint; /* call madvice on free pages? */ |
156 | static int malloc_junk; /* junk fill? */ | 156 | static int malloc_junk; /* junk fill? */ |
157 | static int malloc_move; /* move allocations to end of page? */ | 157 | static int malloc_move = 1; /* move allocations to end of page? */ |
158 | static int malloc_realloc; /* always realloc? */ | 158 | static int malloc_realloc; /* always realloc? */ |
159 | static int malloc_xmalloc; /* xmalloc behaviour? */ | 159 | static int malloc_xmalloc; /* xmalloc behaviour? */ |
160 | static int malloc_zero; /* zero fill? */ | 160 | static int malloc_zero; /* zero fill? */ |