Assert We Allocated Approximately What We Expected To

This commit is contained in:
W. Felix Handte
2020-05-12 16:55:03 -04:00
parent 27e2482217
commit 1aa6c7ccce
2 changed files with 11 additions and 0 deletions
+6
View File
@@ -1578,6 +1578,12 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
ZSTD_window_clear(&zc->ldmState.window);
}
/* Due to alignment, when reusing a workspace, we can actually consume
* up to 3 extra bytes for alignment. See the comments in zstd_cwksp.h
*/
assert(ZSTD_cwksp_used(ws) >= neededSpace &&
ZSTD_cwksp_used(ws) <= neededSpace + 3);
DEBUGLOG(3, "wksp: finished allocating, %zd bytes remain available", ZSTD_cwksp_available_space(ws));
zc->initialized = 1;