From: Nicholas Clark Date: Mon, 9 May 2005 16:33:57 +0000 (+0000) Subject: Update the comment describing arenas. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4977e971c94c012c59e3e99429a0cef3af185c4b;p=p5sagit%2Fp5-mst-13.2.git Update the comment describing arenas. p4raw-id: //depot/perl@24429 --- diff --git a/sv.c b/sv.c index 386b30b..a20eae8 100644 --- a/sv.c +++ b/sv.c @@ -63,14 +63,13 @@ av, hv...) contains type and reference count information, as well as a pointer to the body (struct xrv, xpv, xpviv...), which contains fields specific to each type. -Normally, this allocation is done using arenas, which are approximately -1K chunks of memory parcelled up into N heads or bodies. The first slot -in each arena is reserved, and is used to hold a link to the next arena. -In the case of heads, the unused first slot also contains some flags and -a note of the number of slots. Snaked through each arena chain is a +Normally, this allocation is done using arenas, which by default are +approximately 4K chunks of memory parcelled up into N heads or bodies. The +first slot in each arena is reserved, and is used to hold a link to the next +arena. In the case of heads, the unused first slot also contains some flags +and a note of the number of slots. Snaked through each arena chain is a linked list of free items; when this becomes empty, an extra arena is -allocated and divided up into N items which are threaded into the free -list. +allocated and divided up into N items which are threaded into the free list. The following global variables are associated with arenas: @@ -86,7 +85,8 @@ are not allocated using arenas, but are instead just malloc()/free()ed as required. Also, if PURIFY is defined, arenas are abandoned altogether, with all items individually malloc()ed. In addition, a few SV heads are not allocated from an arena, but are instead directly created as static -or auto variables, eg PL_sv_undef. +or auto variables, eg PL_sv_undef. The size of arenas can be changed from +the default by setting PERL_ARENA_SIZE appropriately at compile time. The SV arena serves the secondary purpose of allowing still-live SVs to be located and destroyed during final cleanup.