rename
[rrq/rrqforth.git] / adoc / p_malloc.adoc
index f1dd8016b2bfb1a649025e612cc0bdd68496181f..4a86f0ba37b228aae0dd7c7ebdd7b51ae71bae52 100644 (file)
@@ -1,9 +1,21 @@
+// stdio.asm:  WORD p_malloc,'MALLOC',fasm
+
 anchor:p_malloc[]
 
-Word: MALLOC
-------------
+=== Word: MALLOC
+
+....
+Data stack: ( n -- a )
+....
+
+"MALLOC" is a word that allocates memory using mmap of at least n
+bytes and returns the lowest address of the allocated block.
+
+Note that this makes new page allocations for the process from the
+kernel, and the granularity is in pages, i.e. a multiple of 4 kb.
 
-----
-stdio.asm:     WORD p_malloc,'MALLOC',fasm
-----
+The memory is allocated with READ and WRITE access but not EXEC
+access, and flagged as PRIVATE, ANONYMOUS and LOCKED. See the "man
+page" of mmap for details.
 
+See also <<p_stream,STREAM>>