From 013df84b3c633f5dd990f7c9b4cd99f5c870ebcd Mon Sep 17 00:00:00 2001
From: Mattias Andrée <maandree@operamail.com>
Date: Sat, 17 Oct 2015 23:48:36 +0200
Subject: info: more on alloca
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Mattias Andrée <maandree@operamail.com>
---
 doc/info/chap/memory-allocation.texinfo | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

(limited to 'doc/info')

diff --git a/doc/info/chap/memory-allocation.texinfo b/doc/info/chap/memory-allocation.texinfo
index a9d3c7e..5107d3a 100644
--- a/doc/info/chap/memory-allocation.texinfo
+++ b/doc/info/chap/memory-allocation.texinfo
@@ -305,6 +305,10 @@ tries to access memory that could not be allocated,
 or, depending on the kernel's configuration, before
 it returns.
 
+On typical kernels and kernel configurations,
+@code{alloca} and @code{malloc} will handle memory
+exhaustion identically.
+
 Undefined behaviour may be invoked if @code{alloca}
 is called within a function call. The behaviour
 depends on the machine, the compiler, and
@@ -314,6 +318,21 @@ optimisations. You should avoid code similar to
   strcpy(alloca((strlen(string) + 1) * sizeof(char)), string)
 @end example
 
+@code{alloca} has its restricts --- limited lifetime,
+cannot be explicitly deallocated, not growable, and
+not shrinkable ---  but it can also be advantageous
+because:
+@itemize
+@item
+Results in cleaner code because it is deallocated
+automatically.
+@item
+It does not waste any space on metainformation
+required for bookkeeping.
+@item
+Uses a faster memory allocation mechanism.
+@end itemize
+
 
 
 @node Basic memory allocation
-- 
cgit v1.2.3-70-g09d2