X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=adoc%2Fp_malloc.adoc;h=4a86f0ba37b228aae0dd7c7ebdd7b51ae71bae52;hb=a0aa0a5825ce306120666fd5425308a8ec9314f8;hp=f1dd8016b2bfb1a649025e612cc0bdd68496181f;hpb=b7da3f7bbd1cb10241163abdb950472e539e796d;p=rrq%2Frrqforth.git diff --git a/adoc/p_malloc.adoc b/adoc/p_malloc.adoc index f1dd801..4a86f0b 100644 --- a/adoc/p_malloc.adoc +++ b/adoc/p_malloc.adoc @@ -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 <>