Project Alice
|
#include <zstd_cwksp.h>
Public Attributes | |
void * | workspace |
void * | workspaceEnd |
void * | objectEnd |
void * | tableEnd |
void * | tableValidEnd |
void * | allocStart |
void * | initOnceStart |
BYTE | allocFailed |
int | workspaceOversizedDuration |
ZSTD_cwksp_alloc_phase_e | phase |
ZSTD_cwksp_static_alloc_e | isStatic |
Zstd fits all its internal datastructures into a single continuous buffer, so that it only needs to perform a single OS allocation (or so that a buffer can be provided to it and it can perform no allocations at all). This buffer is called the workspace.
Several optimizations complicate that process of allocating memory ranges from this workspace for each internal datastructure:
To attempt to manage this buffer, given these constraints, the ZSTD_cwksp abstraction was created. It works as follows:
Workspace Layout:
[ ... workspace ... ] [objects][tables ->] free space [<- buffers][<- aligned][<- init once]
The various objects that live in the workspace are divided into the following categories, and are allocated separately:
Allocating Memory:
The various types of objects must be allocated in order, so they can be correctly packed into the workspace buffer. That order is:
Attempts to reserve objects of different types out of order will fail.
Definition at line 158 of file zstd_cwksp.h.
BYTE ZSTD_cwksp::allocFailed |
Definition at line 168 of file zstd_cwksp.h.
void* ZSTD_cwksp::allocStart |
Definition at line 165 of file zstd_cwksp.h.
void* ZSTD_cwksp::initOnceStart |
Definition at line 166 of file zstd_cwksp.h.
ZSTD_cwksp_static_alloc_e ZSTD_cwksp::isStatic |
Definition at line 171 of file zstd_cwksp.h.
void* ZSTD_cwksp::objectEnd |
Definition at line 162 of file zstd_cwksp.h.
ZSTD_cwksp_alloc_phase_e ZSTD_cwksp::phase |
Definition at line 170 of file zstd_cwksp.h.
void* ZSTD_cwksp::tableEnd |
Definition at line 163 of file zstd_cwksp.h.
void* ZSTD_cwksp::tableValidEnd |
Definition at line 164 of file zstd_cwksp.h.
void* ZSTD_cwksp::workspace |
Definition at line 159 of file zstd_cwksp.h.
void* ZSTD_cwksp::workspaceEnd |
Definition at line 160 of file zstd_cwksp.h.
int ZSTD_cwksp::workspaceOversizedDuration |
Definition at line 169 of file zstd_cwksp.h.