diff options
author | Tim Peters <tim.peters@gmail.com> | 2006-03-02 21:41:18 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2006-03-02 21:41:18 (GMT) |
commit | f6386306fb0237c1bb7a344808acf1dd5c9ec94a (patch) | |
tree | 8595f2c620e02cd7154d75e01d02e6dfbf9f2624 | |
parent | 6fd92dc44f6bd6d0bb0308b298d21f181b083bd2 (diff) | |
download | cpython-f6386306fb0237c1bb7a344808acf1dd5c9ec94a.zip cpython-f6386306fb0237c1bb7a344808acf1dd5c9ec94a.tar.gz cpython-f6386306fb0237c1bb7a344808acf1dd5c9ec94a.tar.bz2 |
Document the purpose of the struct _block members.
-rw-r--r-- | Python/pyarena.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Python/pyarena.c b/Python/pyarena.c index 33261b4..242ca1d 100644 --- a/Python/pyarena.c +++ b/Python/pyarena.c @@ -1,7 +1,7 @@ #include "Python.h" #include "pyarena.h" -/* A simple arena block structure +/* A simple arena block structure. Measurements with standard library modules suggest the average allocation is about 20 bytes and that most compiles use a single @@ -10,9 +10,26 @@ #define DEFAULT_BLOCK_SIZE 8192 typedef struct _block { + /* Total number of bytes owned by this block available to pass out. + * Read-only after initialization. The first such byte starts at + * ab_mem. + */ size_t ab_size; + + /* Total number of bytes already passed out. The next byte available + * to pass out starts at ab_mem + ab_offset. + */ size_t ab_offset; + + /* An arena maintains a singly-linked, NULL-terminated list of + * all blocks owned by the arena. These are linked via the + * ab_next member. + */ struct _block *ab_next; + + /* Pointer to the first allocatable byte owned by this block. Read- + * only after initialization. + */ void *ab_mem; } block; |