pagealign_alloc: Doc and comments.
authorBruno Haible <bruno@clisp.org>
Fri, 25 Nov 2011 23:24:43 +0000 (00:24 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 25 Nov 2011 23:24:43 +0000 (00:24 +0100)
* doc/posix-functions/posix_memalign.texi: Refer to the pagealign_alloc
module.
* lib/pagealign_alloc.c (pagealign_alloc): Add comment.

ChangeLog
doc/posix-functions/posix_memalign.texi
lib/pagealign_alloc.c

index 9623f17..056a500 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-11-25  Bruno Haible  <bruno@clisp.org>
+
+       pagealign_alloc: Doc and comments.
+       * doc/posix-functions/posix_memalign.texi: Refer to the pagealign_alloc
+       module.
+       * lib/pagealign_alloc.c (pagealign_alloc): Add comment.
+
 2011-11-25  Jim Meyering  <meyering@redhat.com>
 
        test-update-copyright.sh: avoid false-positive failure
index 2ffb334..82455aa 100644 (file)
@@ -17,3 +17,6 @@ This function is missing on some platforms:
 MacOS X 10.5, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11,
 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, MSVC 9, Interix 3.5, BeOS.
 @end itemize
+
+The Gnulib module @code{pagealign_alloc} provides a similar API
+that returns memory aligned on a system page boundary.
index b40d960..cfd301a 100644 (file)
@@ -123,6 +123,9 @@ void *
 pagealign_alloc (size_t size)
 {
   void *ret;
+  /* We prefer the mmap() approach over the posix_memalign() or malloc()
+     based approaches, since the latter often waste an entire memory page
+     per call.  */
 #if HAVE_MMAP
 # ifdef HAVE_MAP_ANONYMOUS
   const int fd = -1;