On this page:
_ pooled-pointer
pooled-pointer?
pointer-pool
_ pool
_ pool/ null
pool?
current-pool
make-pool
pool-ancestor?
wrapper-with-pool
wrapper-with-pool*
malloc/ pool
bytes-copy/ pool
Version: 4.2.1

1.2 Memory Pools

_pooled-pointer : ctype?
C pointer type that records the pool in which it is allocated as a tag.

(pooled-pointer? obj)  any
  obj : any/c
Checks whether the given obj is a pooled C pointer.

(pointer-pool obj)  (or/c pool? #f)
  obj : any/c
Retrieves the pool in which obj was allocated. Returns a memory pool object or #f if obj is not a pooled C pointer.

_pool : ctype?
_pool/null : ctype?
C pointer type of a memory pool.

(pool? obj)  any
  obj : any/c
Checks whether the given obj is a memory pool.

(current-pool)  (or/c pool? #f)
(current-pool pool)  void?
  pool : (or/c pool? #f)
Holds the memory pool to use for any native calls in the current dynamic scope that require one.

(make-pool [parent])  pool?
  parent : (or/c pool? #f) = (current-pool)
Creates a new memory pool that is a child of parent. When the parent pool is destroyed so are all its children.

The pool is automatically destroyed by a finalizer when no more references from Scheme code to the pool itself, to its subpools or to any objects allocated in the pool or its subpools exist.

(pool-ancestor? a b)  boolean?
  a : (or/c pool? #f)
  b : pool?
Checks whether a is a parent memory pool of b.

(wrapper-with-pool lambda-list (proc-expr arg-exprs ...))
Evaluates to an anonymous procedure that takes arguments as specified by lambda-list and executes (proc-expr arg-exprs ...) with a parameterization that includes a newly created child pool of the (current-pool).

The proc-expr is evaluated only once, not for each invocation of the resulting procedure.

This macro is mainly intended for the quick implementation of wrappers around C library calls.

(wrapper-with-pool* lambda-list (proc-expr arg-exprs ...))
Works like wrapper-with-pool but only creates a new memory pool if (current-pool) returns #f.

(malloc/pool size)  pooled-pointer?
  size : exact-positive-integer?
Allocates size bytes from the (current-pool) and returns an untyped pooled pointer to the uninitialized data block.

This procedure is unsafe.

(bytes-copy/pool bytes)  pooled-pointer?
  bytes : bytes?
Allocates a copy of bytes in the (current-pool) and returns an untyped pooled pointer to the data.

This procedure is unsafe.