ToolDAQFramework
Public Attributes | List of all members
ZSTD_cwksp Struct Reference

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
 

Detailed Description

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:

  1. Objects
  2. Init once / Tables
  3. Aligned / Tables
  4. Buffers / Tables

Attempts to reserve objects of different types out of order will fail.


The documentation for this struct was generated from the following file: