LZ4_loadDict(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– LZ4_loadDict(9) β€” the kernel API manual, but make it make sense πŸ’–

okay so this is from the Kernel API Manual, section 9, and honestly? it's giving "tiny function, big responsibilities." let's get into it πŸŽ€


✨ NAME ✨

LZ4_loadDict β€” bestie, this one loads a static dictionary into an LZ4_stream. that's the whole vibe. πŸ’…


🌸 SYNOPSIS 🌸

int LZ4_loadDict (LZ4_stream_t *streamPtr , const char *dictionary , int
dictSize );

like, three args, one int coming back at you. we love a simple signature fr fr 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • streamPtr β€” pointer to the LZ4_stream_t. your stream. your main character. it's the thing you're shoving the dict into ✨
  • dictionary β€” the dictionary you're loading. literally the dict in question πŸ“
  • dictSize β€” size of the dictionary. gotta tell it how big the thing is, no cap πŸ“

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea β˜• β€” use this function to load a static dictionary into LZ4_stream.

and listen, this is the important part: ANY previous data will be forgotten. not archived, not tucked away, not "we'll deal with it later" β€” forgotten πŸ’€ only dictionary will remain in memory. so if you had stuff in there you cared about, sorry bestie, it's gone πŸ™ˆ

also, loading a size of 0 is allowed. yes, zero. it's valid. it's iconic. don't @ me πŸ‘‘


🌈 RETURN 🌈

returns the dictionary size, in bytes β€” and it's necessarily <= 64 KB. that's a hard cap, so plan accordingly. 64 KB is the ceiling and the ceiling is not moving πŸ’…


⭐ SEE ALSO ⭐

lowkey a whole friend group here, so let me introduce everyone 🫢

kernel file ./include/linux/lz4.h, plus:

LZ4_compressBound(9), LZ4_compress_default(9), LZ4_compress_fast(9), LZ4_compress_destSize(9), LZ4_decompress_fast(9), LZ4_decompress_safe(9), LZ4_decompress_safe_partial(9), LZ4_compress_HC(9), LZ4_resetStreamHC(9), LZ4_loadDictHC(9), LZ4_compress_HC_continue(9), LZ4_saveDictHC(9), LZ4_resetStream(9), LZ4_saveDict(9), LZ4_compress_fast_continue(9), LZ4_setStreamDecode(9), LZ4_decompress_safe_continue(9), LZ4_decompress_fast_continue(9), LZ4_decompress_safe_usingDict(9), LZ4_decompress_fast_usingDict(9)


reminder bestie: LZ4_loadDict and LZ4_loadDictHC are not the same function. one's the regular girlie, one's the HC version. don't mix them up 😭

and that's the page!! this one lives under ./include/linux, dating all the way to October 2026 β€” yeah, the future called, it's us 🌸✨ mwah, go compress something cute πŸ’–

πŸ“¦ where this page comes from