The SSM allocator allows programs to allocate contiguous chunks of reference-counted memory whose contents are of arbitrary layout. This object type provides users the flexibility to extend runtime with objects that the runtime does not natively support, so long as they commit to managing stored resources themselves, because the garbage collector will not scan the payload for other managed heap pointers.
Blobs use size-flavored ssm_mm headers, where the size field determines the size of blob payload. To support even larger blob sizes, the actual size is divided by SSM_BLOB_SIZE_SCALE while stored in size.
The heap memory layout for blobs are described by ssm_blob1.
◆ SSM_BLOB_SIZE_SCALE
#define SSM_BLOB_SIZE_SCALE 4 |
The size resolution for heap-allocated blobs.
Definition at line 1067 of file ssm.h.
◆ ssm_blob_size
Compute the size of a blob with its header.
The size parameter should already be scaled, i.e., already multiplied by SSM_BLOB_SIZE_SCALE, before being passed into this macro.
- Parameters
-
size | scaled size of the blob's payload. |
- Returns
- size that a blob of size payload occupies in the heap.
Definition at line 1106 of file ssm.h.
◆ ssm_blob_heap_size
Compute the size a blob in the heap.
- Parameters
-
- Returns
- size of the blob that v points to.
Definition at line 1114 of file ssm.h.
◆ ssm_blob_payload
◆ ssm_new_blob
#define ssm_new_blob |
( |
|
s | ) |
|
Value: (fprintf(stderr, "%s:%d:ssm_new_blob(%lu)\n", __FILE__, __LINE__, (size)), \
ssm_new_blob_int(size))
Definition at line 1128 of file ssm.h.
◆ ssm_new_blob_int()
Allocate a blob on the heap.
- Parameters
-
size | size of the payload to the allocated. |
- Returns
- ssm_value_t pointing to heap-allocated blob.
Definition at line 313 of file ssm-mem.c.