Rizin
unix-like reverse engineering framework and cli tools
memusage.c File Reference

Calculates memory usage using lzma_memory_usage() More...

#include "sysdefs.h"
#include "lzma.h"
#include <stdio.h>

Go to the source code of this file.

Functions

int main (void)
 

Detailed Description

Calculates memory usage using lzma_memory_usage()

Definition in file memusage.c.

Function Documentation

◆ main()

int main ( void  )

Definition at line 18 of file memusage.c.

19 {
20  lzma_options_lzma lzma = {
21  .dict_size = (1U << 30) + (1U << 29),
22  .lc = 3,
23  .lp = 0,
24  .pb = 2,
25  .preset_dict = NULL,
26  .preset_dict_size = 0,
27  .mode = LZMA_MODE_NORMAL,
28  .nice_len = 48,
29  .mf = LZMA_MF_BT4,
30  .depth = 0,
31  };
32 
33 /*
34  lzma_options_filter filters[] = {
35  { LZMA_FILTER_LZMA1,
36  (lzma_options_lzma *)&lzma_preset_lzma[6 - 1] },
37  { UINT64_MAX, NULL }
38  };
39 */
40  lzma_filter filters[] = {
41  { LZMA_FILTER_LZMA1, &lzma },
42  { UINT64_MAX, NULL }
43  };
44 
45  printf("Encoder: %10" PRIu64 " B\n",
46  lzma_raw_encoder_memusage(filters));
47  printf("Decoder: %10" PRIu64 " B\n",
48  lzma_raw_decoder_memusage(filters));
49 
50  return 0;
51 }
const lzma_filter * filters
Definition: container.h:315
#define NULL
Definition: cris-opc.c:27
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
Definition: cs_driver.c:93
#define PRIu64
Definition: macros.h:18
@ LZMA_MODE_NORMAL
Normal compression.
Definition: lzma12.h:147
#define LZMA_FILTER_LZMA1
LZMA1 Filter ID.
Definition: lzma12.h:30
@ LZMA_MF_BT4
Binary Tree with 2-, 3-, and 4-byte hashing.
Definition: lzma12.h:101
#define UINT64_MAX
Filter options.
Definition: filter.h:43
Options specific to the LZMA1 and LZMA2 filters.
Definition: lzma12.h:185
uint32_t dict_size
Dictionary size in bytes.
Definition: lzma12.h:217

References lzma_options_lzma::dict_size, filters, LZMA_FILTER_LZMA1, LZMA_MF_BT4, LZMA_MODE_NORMAL, NULL, printf(), PRIu64, and UINT64_MAX.