On this page:
_ pooled-pointer
_ pool
_ pool/ null
bytes-copy/ pool

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.

(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.

(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.