Next: , Previous: , Up: iklib memory   [Index]


6.46.4 Memory blocks

The following bindings are exported by the libraries (vicare) and (vicare system $foreign) and reexported by the library (vicare ffi).

Object Type: <memory-block>

Disjoint object used to reference a raw memory block through a pointer and number of bytes. It has the following public fields:

pointer

A pointer object referencing the first byte of memory.

size

The number of bytes in the memory block; it is an exact integer in the range of the C language type size_t.

Function: make-memory-block pointer size
Function: make-memory-block/guarded pointer size

Build and return a new instance of memory-block referencing a memory block pointed to by pointer and of size number of bytes.

When a memory-block built by make-memory-block is garbage collected: nothing happens.

When a memory-block built by make-memory-block/guarded is garbage collected: the referenced memory block is released with free from (vicare).

Function: memory-block? obj

Return #t if obj is an instance of memory-block.

Function: memory-block?/non-null obj
Function: memory-block?/not-null obj

Return #t if obj is an instance of memory-block and the pointer is not NULL.

Function: memory-block-pointer mblock
Function: memory-block-size mblock

Accessors for the fields of memory-block instances. The pointer object returned by memory-block-pointer is a copy of the pointer object in mblock.

Function: memory-block-reset mblock

Reset an instance of memory-block to a NULL pointer and zero size; return unspecified values. If mblock has been created to release the referenced memory block: the memory block is freed.

Function: null-memory-block

Build and return a new instance of memory-block holding a new NULL pointer object and zero as size.

Function: memory-block=? mblock0 mblock

All the arguments must be instances of <memory-block>. Return #t if all the arguments have equal memory address and block size; otherwise return #f. When applied to a single argument: return #t.

Function: memory-block!=? mblock0 mblock

The arguments must be <memory-block> instances. Return #t if the arguments are all different: no two arguments are equal; otherwise return #f. When applied to a single argument: return #f.


Next: , Previous: , Up: iklib memory   [Index]